package com.ruoyi.web.controller.system;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.listener.PageReadListener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpClientUtil;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.stock.SectorMarkupSortUtils;
import com.ruoyi.system.domain.StockMainBoard;
import com.ruoyi.system.domain.StockMainBoardAndDetail;
import com.ruoyi.system.domain.StockMainBoardDetail;
import com.ruoyi.system.service.IStockMainBoardCustomService;
import com.ruoyi.system.service.IStockMainBoardDetailService;
import com.ruoyi.system.service.IStockMainBoardService;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.web.controller.mail.MailService;
import com.ruoyi.web.controller.system.sto.StockRankingSto;
import com.ruoyi.web.controller.system.sto.StockTransactionSto;
import com.ruoyi.web.controller.system.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URL;
import java.net.http.HttpResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;


/**
 * 股票主板Controller
 *
 * @author ruoyi
 * @date 2024-12-30
 */
@Controller
@RequestMapping("/system/main/board/one")
public class StockMainBoardOneController extends BaseController {
    private String prefix = "system/main/one";

    @Autowired
    private IStockMainBoardService stockMainBoardService;
    @Autowired
    private IStockMainBoardCustomService stockMainBoardCustomService;
    @Autowired
    private IStockMainBoardDetailService stockMainBoardDetailService;
    @Autowired
    private ISysDictDataService dictDataService;

    private static final int THREAD_COUNT = 15; // 定义线程数量
    private static final int BATCH_SIZE = 300; // 每批次处理的参数数量

    @Autowired
    private MailService mailService;

    @GetMapping()
    public String board() {
        return prefix + "/board";
    }


    /**
     * 新增股票主板
     */
    @GetMapping("/add")
    public String add() {
        return prefix + "/add";
    }

    /**
     * 新增保存股票主板
     */
    @Log(title = "股票主板", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(StockMainBoard stockMainBoard) {
        return toAjax(stockMainBoardService.insertStockMainBoard(stockMainBoard));
    }

    /**
     * 修改股票主板
     */
    @GetMapping("/edit/{mainId}")
    public String edit(@PathVariable("mainId") Long mainId, ModelMap mmap) {
        StockMainBoard stockMainBoard = stockMainBoardService.selectStockMainBoardByMainId(mainId);
        mmap.put("stockMainBoard", stockMainBoard);
        return prefix + "/edit";
    }

    /**
     * 修改保存股票主板
     */
    @Log(title = "股票主板", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(StockMainBoard stockMainBoard) {
        return toAjax(stockMainBoardService.updateStockMainBoard(stockMainBoard));
    }


    /**
     * 主板股票详细列表
     */

    @PostMapping("/allStockMainBoardDetail")
    @ResponseBody
    public List<StockMainBoardAndDetail> getAllStockMainBoardDetail(MultipartHttpServletRequest request) {
        String mainId = request.getParameter("mainId");
        StockMainBoardDetail stockMainBoardDetail = new StockMainBoardDetail();
        stockMainBoardDetail.setMainId(Long.valueOf(mainId));
        StockMainBoard mainBoard = stockMainBoardService.selectStockMainBoardByMainId(Long.valueOf(mainId));
        List<StockMainBoardDetail> stockMainBoardDetails = stockMainBoardDetailService.selectStockMainBoardDetailList(stockMainBoardDetail);
        List<StockMainBoardAndDetail> stockMainBoardAndDetailList = stockMainBoardDetails.stream().map(person -> {
            StockMainBoardAndDetail stockMainBoardAndDetail = new StockMainBoardAndDetail();
            stockMainBoardAndDetail.setStockName(mainBoard.getStockName());
            stockMainBoardAndDetail.setStockPrice(person.getLastPx());
            stockMainBoardAndDetail.setDay(person.getDay());
            return stockMainBoardAndDetail;
        }).collect(Collectors.toList());
        return stockMainBoardAndDetailList;
    }

    /**
     * 导出股票主板列表
     */

    @Log(title = "股票主板", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(StockMainBoard stockMainBoard) {
        List<StockMainBoard> list = stockMainBoardService.selectStockMainBoardList(stockMainBoard);
        ExcelUtil<StockMainBoard> util = new ExcelUtil<StockMainBoard>(StockMainBoard.class);
        return util.exportExcel(list, "股票主板数据");
    }


    /**
     * 根据主板id查询股票详细
     */

    @GetMapping("/detail/{mainId}")
    public String detail(@PathVariable("mainId") Long mainId, ModelMap mmap) {
        return prefix + "/detail";
    }

    /**
     * 删除股票主板
     */
    @Log(title = "股票主板", businessType = BusinessType.DELETE)
    @PostMapping("/remove")
    @ResponseBody
    public AjaxResult remove(String ids) {
        String[] idsSplit = ids.split(",");
        for (String id : idsSplit) {
            StockMainBoardDetail stockMainBoardDetail = new StockMainBoardDetail();
            stockMainBoardDetail.setMainId(Long.valueOf(id));
            List<StockMainBoardDetail> stockMainBoardDetails = stockMainBoardDetailService.selectStockMainBoardDetailList(stockMainBoardDetail);
            if (stockMainBoardDetails.size() > 0) {
                String joint = stockMainBoardDetails.stream().map(a -> {
                            Long detailId = a.getDetailId();
                            return String.valueOf(detailId);
                        }) // 提取name属性
                        .collect(Collectors.joining(","));
                stockMainBoardDetailService.deleteStockMainBoardDetailByDetailIds(joint);
            }
        }
        return toAjax(stockMainBoardService.deleteStockMainBoardByMainIds(ids));
    }


    @GetMapping("/importTemplate")
    @ResponseBody
    public AjaxResult importTemplate() {
        ExcelUtil<StockMainBoard> util = new ExcelUtil<StockMainBoard>(StockMainBoard.class);
        return util.importTemplateExcel("股票主表数据");
    }

    /**
     * 主板股票数据导入
     */

    @Log(title = "股票主板", businessType = BusinessType.IMPORT)
    @PostMapping("/importData")
    @ResponseBody
    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
        ExcelUtil<StockMainBoard> util = new ExcelUtil<StockMainBoard>(StockMainBoard.class);
        List<StockMainBoard> stockMainBoardList = util.importExcel(file.getInputStream());
        String message = stockMainBoardService.importStockMainBoard(stockMainBoardList, updateSupport, getLoginName());
        return AjaxResult.success(message);
    }

    /**
     * 改变购买状态
     */
    @PostMapping("/changeStatus")
    @ResponseBody
    public AjaxResult changeStatus(StockMainBoard stockMainBoard) {
        return toAjax(stockMainBoardService.changeStatus(stockMainBoard));
    }


    /**
     * 将参数分成批次
     */
    private static List<List<String>> createBatches(List<String> list, int batchSize) {
        List<List<String>> batches = new ArrayList<>();
        for (int i = 0; i < list.size(); i += batchSize) {
            batches.add(list.subList(i, Math.min(i + batchSize, list.size())));
        }
        return batches;
    }


    /**
     * 查询股票主板列表
     */

    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(StockMainBoard stockMainBoard) {
        //主板类型
        stockMainBoard.setStockType("1");

        //设置流通市值的各种状态
        String actualCirculationStatus = stockMainBoard.getActualCirculationStatus();
        if (StringUtils.isNotEmpty(actualCirculationStatus)) {
            if (actualCirculationStatus.equals("0")) {
                stockMainBoard.setActualCirculationAllStatus("0");
            } else if (actualCirculationStatus.equals("1")) {
                stockMainBoard.setActualCirculationTypeStatus("1");
            } else if (actualCirculationStatus.equals("2")) {
                stockMainBoard.setActualCirculationTypeStatus("2");
            } else if (actualCirculationStatus.equals("3")) {
                stockMainBoard.setActualCirculationTypeStatus("3");
            }
        }

        //固定题材
        String fixTopicsStatus = stockMainBoard.getFixTopicsStatus();
        if (StringUtils.isNotEmpty(fixTopicsStatus)) {
            if (fixTopicsStatus.equals("1")) {
                stockMainBoard.setFixTopicsOne("1");
            } else if (fixTopicsStatus.equals("2")) {
                stockMainBoard.setFixTopicsTwo("2");
            } else if (fixTopicsStatus.equals("3")) {
                stockMainBoard.setFixTopicsThree("3");
            } else if (fixTopicsStatus.equals("4")) {
                stockMainBoard.setFixTopicsFour("4");
            } else if (fixTopicsStatus.equals("5")) {
                stockMainBoard.setFixTopicsFive("5");
            } else if (fixTopicsStatus.equals("6")) {
                stockMainBoard.setFixTopicsSix("6");
            } else if (fixTopicsStatus.equals("7")) {
                stockMainBoard.setFixTopicsSeven("7");
            } else if (fixTopicsStatus.equals("8")) {
                stockMainBoard.setFixTopicsEight("8");
            } else if (fixTopicsStatus.equals("9")) {
                stockMainBoard.setFixTopicsNine("9");
            } else if (fixTopicsStatus.equals("10")) {
                stockMainBoard.setFixTopicsTen("10");
            }
        }


        //动态题材
        String dynamicTopicsStatus = stockMainBoard.getDynamicTopicsStatus();
        if (StringUtils.isNotEmpty(dynamicTopicsStatus)) {
            if (dynamicTopicsStatus.equals("1")) {
                stockMainBoard.setDynamicTopicsOne("1");
            } else if (dynamicTopicsStatus.equals("2")) {
                stockMainBoard.setDynamicTopicsTwo("2");
            } else if (dynamicTopicsStatus.equals("3")) {
                stockMainBoard.setDynamicTopicsThree("3");
            } else if (dynamicTopicsStatus.equals("4")) {
                stockMainBoard.setDynamicTopicsFour("4");
            } else if (dynamicTopicsStatus.equals("5")) {
                stockMainBoard.setDynamicTopicsFive("5");
            } else if (dynamicTopicsStatus.equals("6")) {
                stockMainBoard.setDynamicTopicsSix("6");
            } else if (dynamicTopicsStatus.equals("7")) {
                stockMainBoard.setDynamicTopicsSeven("7");
            } else if (dynamicTopicsStatus.equals("8")) {
                stockMainBoard.setDynamicTopicsEight("8");
            } else if (dynamicTopicsStatus.equals("9")) {
                stockMainBoard.setDynamicTopicsNine("9");
            } else if (dynamicTopicsStatus.equals("10")) {
                stockMainBoard.setDynamicTopicsTen("10");
            } else if (dynamicTopicsStatus.equals("11")) {
                stockMainBoard.setDynamicTopicsEleven("11");
            } else if (dynamicTopicsStatus.equals("12")) {
                stockMainBoard.setDynamicTopicsTwelve("12");
            } else if (dynamicTopicsStatus.equals("13")) {
                stockMainBoard.setDynamicTopicsThirteen("13");
            } else if (dynamicTopicsStatus.equals("14")) {
                stockMainBoard.setDynamicTopicsFourteen("14");
            } else if (dynamicTopicsStatus.equals("15")) {
                stockMainBoard.setDynamicTopicsFifteen("15");
            } else if (dynamicTopicsStatus.equals("16")) {
                stockMainBoard.setDynamicTopicsSixteen("16");
            } else if (dynamicTopicsStatus.equals("17")) {
                stockMainBoard.setDynamicTopicsSeventeen("17");
            } else if (dynamicTopicsStatus.equals("18")) {
                stockMainBoard.setDynamicTopicsEighteen("18");
            } else if (dynamicTopicsStatus.equals("19")) {
                stockMainBoard.setDynamicTopicsNineteen("19");
            } else if (dynamicTopicsStatus.equals("20")) {
                stockMainBoard.setDynamicTopicsTwenty("20");
            }
        }

        //动态惊喜题材
        String dynamicTopicsSurpriseStatus = stockMainBoard.getDynamicTopicsSurpriseStatus();
        if (StringUtils.isNotEmpty(dynamicTopicsSurpriseStatus)) {
            if (dynamicTopicsSurpriseStatus.equals("1")) {
                stockMainBoard.setDynamicTopicsSurpriseOne("1");
            } else if (dynamicTopicsSurpriseStatus.equals("2")) {
                stockMainBoard.setDynamicTopicsSurpriseTwo("2");
            } else if (dynamicTopicsSurpriseStatus.equals("3")) {
                stockMainBoard.setDynamicTopicsSurpriseThree("3");
            } else if (dynamicTopicsSurpriseStatus.equals("4")) {
                stockMainBoard.setDynamicTopicsSurpriseFour("4");
            } else if (dynamicTopicsSurpriseStatus.equals("5")) {
                stockMainBoard.setDynamicTopicsSurpriseFive("5");
            } else if (dynamicTopicsSurpriseStatus.equals("6")) {
                stockMainBoard.setDynamicTopicsSurpriseSix("6");
            } else if (dynamicTopicsSurpriseStatus.equals("7")) {
                stockMainBoard.setDynamicTopicsSurpriseSeven("7");
            } else if (dynamicTopicsSurpriseStatus.equals("8")) {
                stockMainBoard.setDynamicTopicsSurpriseEight("8");
            } else if (dynamicTopicsSurpriseStatus.equals("9")) {
                stockMainBoard.setDynamicTopicsSurpriseNine("9");
            } else if (dynamicTopicsSurpriseStatus.equals("10")) {
                stockMainBoard.setDynamicTopicsSurpriseTen("10");
            } else if (dynamicTopicsSurpriseStatus.equals("11")) {
                stockMainBoard.setDynamicTopicsSurpriseEleven("11");
            } else if (dynamicTopicsSurpriseStatus.equals("12")) {
                stockMainBoard.setDynamicTopicsSurpriseTwelve("12");
            } else if (dynamicTopicsSurpriseStatus.equals("13")) {
                stockMainBoard.setDynamicTopicsSurpriseThirteen("13");
            } else if (dynamicTopicsSurpriseStatus.equals("14")) {
                stockMainBoard.setDynamicTopicsSurpriseFourteen("14");
            } else if (dynamicTopicsSurpriseStatus.equals("15")) {
                stockMainBoard.setDynamicTopicsSurpriseFifteen("15");
            } else if (dynamicTopicsSurpriseStatus.equals("16")) {
                stockMainBoard.setDynamicTopicsSurpriseSixteen("16");
            } else if (dynamicTopicsSurpriseStatus.equals("17")) {
                stockMainBoard.setDynamicTopicsSurpriseSeventeen("17");
            } else if (dynamicTopicsSurpriseStatus.equals("18")) {
                stockMainBoard.setDynamicTopicsSurpriseEighteen("18");
            } else if (dynamicTopicsSurpriseStatus.equals("19")) {
                stockMainBoard.setDynamicTopicsSurpriseNineteen("19");
            } else if (dynamicTopicsSurpriseStatus.equals("20")) {
                stockMainBoard.setDynamicTopicsSurpriseTwenty("20");
            }
        }


        //动态彩蛋题材
        String dynamicTopicsEggStatus = stockMainBoard.getDynamicTopicsEggStatus();
        if (StringUtils.isNotEmpty(dynamicTopicsEggStatus)) {
            if (dynamicTopicsEggStatus.equals("1")) {
                stockMainBoard.setDynamicTopicsEggOne("1");
            } else if (dynamicTopicsEggStatus.equals("2")) {
                stockMainBoard.setDynamicTopicsEggTwo("2");
            } else if (dynamicTopicsEggStatus.equals("3")) {
                stockMainBoard.setDynamicTopicsEggThree("3");
            } else if (dynamicTopicsEggStatus.equals("4")) {
                stockMainBoard.setDynamicTopicsEggFour("4");
            } else if (dynamicTopicsEggStatus.equals("5")) {
                stockMainBoard.setDynamicTopicsEggFive("5");
            } else if (dynamicTopicsEggStatus.equals("6")) {
                stockMainBoard.setDynamicTopicsEggSix("6");
            } else if (dynamicTopicsEggStatus.equals("7")) {
                stockMainBoard.setDynamicTopicsEggSeven("7");
            } else if (dynamicTopicsEggStatus.equals("8")) {
                stockMainBoard.setDynamicTopicsEggEight("8");
            } else if (dynamicTopicsEggStatus.equals("9")) {
                stockMainBoard.setDynamicTopicsEggNine("9");
            } else if (dynamicTopicsEggStatus.equals("10")) {
                stockMainBoard.setDynamicTopicsEggTen("10");
            } else if (dynamicTopicsEggStatus.equals("11")) {
                stockMainBoard.setDynamicTopicsEggEleven("11");
            } else if (dynamicTopicsEggStatus.equals("12")) {
                stockMainBoard.setDynamicTopicsEggTwelve("12");
            } else if (dynamicTopicsEggStatus.equals("13")) {
                stockMainBoard.setDynamicTopicsEggThirteen("13");
            } else if (dynamicTopicsEggStatus.equals("14")) {
                stockMainBoard.setDynamicTopicsEggFourteen("14");
            } else if (dynamicTopicsEggStatus.equals("15")) {
                stockMainBoard.setDynamicTopicsEggFifteen("15");
            } else if (dynamicTopicsEggStatus.equals("16")) {
                stockMainBoard.setDynamicTopicsEggSixteen("16");
            } else if (dynamicTopicsEggStatus.equals("17")) {
                stockMainBoard.setDynamicTopicsEggSeventeen("17");
            } else if (dynamicTopicsEggStatus.equals("18")) {
                stockMainBoard.setDynamicTopicsEggEighteen("18");
            } else if (dynamicTopicsEggStatus.equals("19")) {
                stockMainBoard.setDynamicTopicsEggNineteen("19");
            } else if (dynamicTopicsEggStatus.equals("20")) {
                stockMainBoard.setDynamicTopicsEggTwenty("20");
            }
        }

        stockMainBoard.setActualCirculationStatus("");
        stockMainBoard.setFixTopicsStatus("");
        stockMainBoard.setDynamicTopicsStatus("");
        stockMainBoard.setDynamicTopicsSurpriseStatus("");
        stockMainBoard.setDynamicTopicsEggStatus("");
        startPage();
        List<StockMainBoard> list = stockMainBoardService.selectStockMainBoardList(stockMainBoard);
        return getDataTable(list);
    }

    @Log(title = "股票主板细节表生成", businessType = BusinessType.GENCODE)
    @GetMapping("/batchStockMainBoardDetail")
    @ResponseBody
    public void batchStockMainBoardDetail(HttpServletResponse response) throws IOException {

//        //第一步：清空数据
//        batchCleanData();
//
//        //第二步：设置主板价格且天数
//        batchPDMainBoardInfoData();
//
//        //第三步：设置主板信息
//        batchMainBoardInfoData();
//
//        //第四步：设置开盘啦数据一
//        batchKaiPanLaDataOne();
//
//        //第五步：设置开盘啦数据二
//        batchKaiPanLaDataTwo();

        //第六步：设置开盘啦数据三
        batchKaiPanLaDataThree();

        //第七步：设置开盘啦数据四
        batchKaiPanLaDataFour();
    }

    /**
     *
     * /第一步：清空数据
     */
    public void batchCleanData() throws IOException {

        //查询主板股票
        StockMainBoard selectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> oneStockMainBoardList = stockMainBoardService.selectStockMainBoardList(selectStockMainBoard);

        //涨停原因
        List<StockMainBoard> limitUpReasonList = oneStockMainBoardList.stream().filter(stockMainBoard -> {
            //涨停原因
            boolean a = stockMainBoard.getLimitUpReason() == null ? false : true;
            return a;
        }).collect(Collectors.toList());
        for (StockMainBoard stockMainBoard : limitUpReasonList) {
            stockMainBoard.setLimitUpReason("-");
            stockMainBoard.setLimitUpReasonSector("-");
            stockMainBoard.setLimitUpReasonDragon("-");
            stockMainBoard.setLimitUpReasonDetail("-");
            stockMainBoardService.updateStockMainBoard(stockMainBoard);
        }


        //右拳、侦查、勾拳、布阵、概念
        //实际流通值、实际流通值状态、实际流通值所有值状态、实际流通值类型状态
        //固定题材状态、固定题材1、固定题材2、固定题材3、固定题材4、固定题材5、固定题材6、固定题材7、固定题材8、固定题材9、固定题材10
        //动态题材状态、动态题材1、动态题材2、动态题材3、动态题材4、动态题材5、动态题材6、动态题材7、动态题材8、动态题材9、动态题材10
        //动态题材显示1、动态题材显示2、动态题材显示3、动态题材显示4、动态题材显示5、动态题材显示6、动态题材显示7、动态题材显示8、动态题材显示9、动态题材显示10
        //动态题材详细显示全部、动态题材详细显示1、动态题材详细显示2、动态题材详细显示3、动态题材详细显示4、动态题材详细显示5、动态题材详细显示6、动态题材详细显示7、动态题材详细显示8、动态题材详细显示9、动态题材详细显示10
        //挺你、辣你、靓你、赞你、顶你、硬你、狂热、炽热
        for (StockMainBoard stockMainBoard : oneStockMainBoardList) {
            //右拳
            stockMainBoard.setRightFistFrequencyTime(null);
            stockMainBoard.setRightFistDegree(null);
            stockMainBoard.setRightFistDegreeTime(null);
            stockMainBoard.setRightFistFallRangeDetail(null);
            stockMainBoard.setRightFistDetail(null);

            //侦查
            stockMainBoard.setInvestigateFrequencyTime(null);
            stockMainBoard.setInvestigateDegree(null);
            stockMainBoard.setInvestigateDegreeTime(null);
            stockMainBoard.setInvestigateFallRangeDetail(null);
            stockMainBoard.setInvestigateDetail(null);

            //勾拳
            stockMainBoard.setHookFrequencyTime(null);
            stockMainBoard.setHookDegree(null);
            stockMainBoard.setHookDegreeTime(null);
            stockMainBoard.setHookFallRangeDetail(null);
            stockMainBoard.setHookDetail(null);

            //布阵
            stockMainBoard.setEmbattleFrequencyTime(null);
            stockMainBoard.setEmbattleDegree(null);
            stockMainBoard.setEmbattleDegreeTime(null);
            stockMainBoard.setEmbattleFallRangeDetail(null);
            stockMainBoard.setEmbattleDetail(null);

            //概念
            stockMainBoard.setConcept(null);
            stockMainBoard.setConceptTime(null);

            //实际流通值、实际流通值状态、实际流通值所有值状态、实际流通值类型状态
            stockMainBoard.setActualCirculationValue(null);
            stockMainBoard.setActualCirculationStatus(null);
            stockMainBoard.setActualCirculationAllStatus(null);
            stockMainBoard.setActualCirculationTypeStatus(null);


            //固定题材状态、固定题材1、固定题材2、固定题材3、固定题材4、固定题材5、固定题材6、固定题材7、固定题材8、固定题材9、固定题材10
            stockMainBoard.setFixTopicsStatus(null);
            stockMainBoard.setFixTopicsOne(null);
            stockMainBoard.setFixTopicsTwo(null);
            stockMainBoard.setFixTopicsThree(null);
            stockMainBoard.setFixTopicsFour(null);
            stockMainBoard.setFixTopicsFive(null);
            stockMainBoard.setFixTopicsSix(null);
            stockMainBoard.setFixTopicsSeven(null);
            stockMainBoard.setFixTopicsEight(null);
            stockMainBoard.setFixTopicsNine(null);
            stockMainBoard.setFixTopicsTen(null);

            //动态题材状态、动态题材1、动态题材2、动态题材3、动态题材4、动态题材5、动态题材6、动态题材7、动态题材8、动态题材9、动态题材10
            stockMainBoard.setDynamicTopicsStatus(null);
            stockMainBoard.setDynamicTopicsOne(null);
            stockMainBoard.setDynamicTopicsTwo(null);
            stockMainBoard.setDynamicTopicsThree(null);
            stockMainBoard.setDynamicTopicsFour(null);
            stockMainBoard.setDynamicTopicsFive(null);
            stockMainBoard.setDynamicTopicsSix(null);
            stockMainBoard.setDynamicTopicsSeven(null);
            stockMainBoard.setDynamicTopicsEight(null);
            stockMainBoard.setDynamicTopicsNine(null);
            stockMainBoard.setDynamicTopicsTen(null);
            stockMainBoard.setDynamicTopicsEleven(null);
            stockMainBoard.setDynamicTopicsTwelve(null);
            stockMainBoard.setDynamicTopicsThirteen(null);
            stockMainBoard.setDynamicTopicsFourteen(null);
            stockMainBoard.setDynamicTopicsFifteen(null);
            stockMainBoard.setDynamicTopicsSixteen(null);
            stockMainBoard.setDynamicTopicsSeventeen(null);
            stockMainBoard.setDynamicTopicsEighteen(null);
            stockMainBoard.setDynamicTopicsNineteen(null);
            stockMainBoard.setDynamicTopicsTwenty(null);


            //动态题材显示1、动态题材显示2、动态题材显示3、动态题材显示4、动态题材显示5、动态题材显示6、动态题材显示7、动态题材显示8、动态题材显示9、动态题材显示10
            stockMainBoard.setDynamicTopicsShowOne(null);
            stockMainBoard.setDynamicTopicsShowTwo(null);
            stockMainBoard.setDynamicTopicsShowThree(null);
            stockMainBoard.setDynamicTopicsShowFour(null);
            stockMainBoard.setDynamicTopicsShowFive(null);
            stockMainBoard.setDynamicTopicsShowSix(null);
            stockMainBoard.setDynamicTopicsShowSeven(null);
            stockMainBoard.setDynamicTopicsShowEight(null);
            stockMainBoard.setDynamicTopicsShowNine(null);
            stockMainBoard.setDynamicTopicsShowTen(null);
            stockMainBoard.setDynamicTopicsShowEleven(null);
            stockMainBoard.setDynamicTopicsShowTwelve(null);
            stockMainBoard.setDynamicTopicsShowThirteen(null);
            stockMainBoard.setDynamicTopicsShowFourteen(null);
            stockMainBoard.setDynamicTopicsShowFifteen(null);
            stockMainBoard.setDynamicTopicsShowSixteen(null);
            stockMainBoard.setDynamicTopicsShowSeventeen(null);
            stockMainBoard.setDynamicTopicsShowEighteen(null);
            stockMainBoard.setDynamicTopicsShowNineteen(null);
            stockMainBoard.setDynamicTopicsShowTwenty(null);


            //动态题材详细显示全部、动态题材详细显示1、动态题材详细显示2、动态题材详细显示3、动态题材详细显示4、动态题材详细显示5、动态题材详细显示6、动态题材详细显示7、动态题材详细显示8、动态题材详细显示9、动态题材详细显示10
            stockMainBoard.setDynamicTopicsDetailShowAll(null);
            stockMainBoard.setDynamicTopicsDetailShowOne(null);
            stockMainBoard.setDynamicTopicsDetailShowTwo(null);
            stockMainBoard.setDynamicTopicsDetailShowThree(null);
            stockMainBoard.setDynamicTopicsDetailShowFour(null);
            stockMainBoard.setDynamicTopicsDetailShowFive(null);
            stockMainBoard.setDynamicTopicsDetailShowSix(null);
            stockMainBoard.setDynamicTopicsDetailShowSeven(null);
            stockMainBoard.setDynamicTopicsDetailShowEight(null);
            stockMainBoard.setDynamicTopicsDetailShowNine(null);
            stockMainBoard.setDynamicTopicsDetailShowTen(null);
            stockMainBoard.setDynamicTopicsDetailShowEleven(null);
            stockMainBoard.setDynamicTopicsDetailShowTwelve(null);
            stockMainBoard.setDynamicTopicsDetailShowThirteen(null);
            stockMainBoard.setDynamicTopicsDetailShowFourteen(null);
            stockMainBoard.setDynamicTopicsDetailShowFifteen(null);
            stockMainBoard.setDynamicTopicsDetailShowSixteen(null);
            stockMainBoard.setDynamicTopicsDetailShowSeventeen(null);
            stockMainBoard.setDynamicTopicsDetailShowEighteen(null);
            stockMainBoard.setDynamicTopicsDetailShowNineteen(null);
            stockMainBoard.setDynamicTopicsDetailShowTwenty(null);


            //动态惊喜题材状态、动态题材1、动态题材2、动态题材3、动态题材4、动态题材5、动态题材6、动态题材7、动态题材8、动态题材9、动态题材10
            stockMainBoard.setDynamicTopicsSurpriseStatus(null);
            stockMainBoard.setDynamicTopicsSurpriseOne(null);
            stockMainBoard.setDynamicTopicsSurpriseTwo(null);
            stockMainBoard.setDynamicTopicsSurpriseThree(null);
            stockMainBoard.setDynamicTopicsSurpriseFour(null);
            stockMainBoard.setDynamicTopicsSurpriseFive(null);
            stockMainBoard.setDynamicTopicsSurpriseSix(null);
            stockMainBoard.setDynamicTopicsSurpriseSeven(null);
            stockMainBoard.setDynamicTopicsSurpriseEight(null);
            stockMainBoard.setDynamicTopicsSurpriseNine(null);
            stockMainBoard.setDynamicTopicsSurpriseTen(null);
            stockMainBoard.setDynamicTopicsSurpriseEleven(null);
            stockMainBoard.setDynamicTopicsSurpriseTwelve(null);
            stockMainBoard.setDynamicTopicsSurpriseThirteen(null);
            stockMainBoard.setDynamicTopicsSurpriseFourteen(null);
            stockMainBoard.setDynamicTopicsSurpriseFifteen(null);
            stockMainBoard.setDynamicTopicsSurpriseSixteen(null);
            stockMainBoard.setDynamicTopicsSurpriseSeventeen(null);
            stockMainBoard.setDynamicTopicsSurpriseEighteen(null);
            stockMainBoard.setDynamicTopicsSurpriseNineteen(null);
            stockMainBoard.setDynamicTopicsSurpriseTwenty(null);


            //动态题材显示1、动态题材显示2、动态题材显示3、动态题材显示4、动态题材显示5、动态题材显示6、动态题材显示7、动态题材显示8、动态题材显示9、动态题材显示10
            stockMainBoard.setDynamicTopicsShowSurpriseOne(null);
            stockMainBoard.setDynamicTopicsShowSurpriseTwo(null);
            stockMainBoard.setDynamicTopicsShowSurpriseThree(null);
            stockMainBoard.setDynamicTopicsShowSurpriseFour(null);
            stockMainBoard.setDynamicTopicsShowSurpriseFive(null);
            stockMainBoard.setDynamicTopicsShowSurpriseSix(null);
            stockMainBoard.setDynamicTopicsShowSurpriseSeven(null);
            stockMainBoard.setDynamicTopicsShowSurpriseEight(null);
            stockMainBoard.setDynamicTopicsShowSurpriseNine(null);
            stockMainBoard.setDynamicTopicsShowSurpriseTen(null);
            stockMainBoard.setDynamicTopicsShowSurpriseEleven(null);
            stockMainBoard.setDynamicTopicsShowSurpriseTwelve(null);
            stockMainBoard.setDynamicTopicsShowSurpriseThirteen(null);
            stockMainBoard.setDynamicTopicsShowSurpriseFourteen(null);
            stockMainBoard.setDynamicTopicsShowSurpriseFifteen(null);
            stockMainBoard.setDynamicTopicsShowSurpriseSixteen(null);
            stockMainBoard.setDynamicTopicsShowSurpriseSeventeen(null);
            stockMainBoard.setDynamicTopicsShowSurpriseEighteen(null);
            stockMainBoard.setDynamicTopicsShowSurpriseNineteen(null);
            stockMainBoard.setDynamicTopicsShowSurpriseTwenty(null);


            //动态惊喜题材详细显示全部、动态题材详细显示1、动态题材详细显示2、动态题材详细显示3、动态题材详细显示4、动态题材详细显示5、动态题材详细显示6、动态题材详细显示7、动态题材详细显示8、动态题材详细显示9、动态题材详细显示10
            stockMainBoard.setDynamicTopicsDetailShowSurpriseAll(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseOne(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseTwo(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseThree(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseFour(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseFive(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseSix(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseSeven(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseEight(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseNine(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseTen(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseEleven(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseTwelve(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseThirteen(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseFourteen(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseFifteen(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseSixteen(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseSeventeen(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseEighteen(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseNineteen(null);
            stockMainBoard.setDynamicTopicsDetailShowSurpriseTwenty(null);


            //动态彩蛋题材状态、动态题材1、动态题材2、动态题材3、动态题材4、动态题材5、动态题材6、动态题材7、动态题材8、动态题材9、动态题材10
            stockMainBoard.setDynamicTopicsEggStatus(null);
            stockMainBoard.setDynamicTopicsEggOne(null);
            stockMainBoard.setDynamicTopicsEggTwo(null);
            stockMainBoard.setDynamicTopicsEggThree(null);
            stockMainBoard.setDynamicTopicsEggFour(null);
            stockMainBoard.setDynamicTopicsEggFive(null);
            stockMainBoard.setDynamicTopicsEggSix(null);
            stockMainBoard.setDynamicTopicsEggSeven(null);
            stockMainBoard.setDynamicTopicsEggEight(null);
            stockMainBoard.setDynamicTopicsEggNine(null);
            stockMainBoard.setDynamicTopicsEggTen(null);
            stockMainBoard.setDynamicTopicsEggEleven(null);
            stockMainBoard.setDynamicTopicsEggTwelve(null);
            stockMainBoard.setDynamicTopicsEggThirteen(null);
            stockMainBoard.setDynamicTopicsEggFourteen(null);
            stockMainBoard.setDynamicTopicsEggFifteen(null);
            stockMainBoard.setDynamicTopicsEggSixteen(null);
            stockMainBoard.setDynamicTopicsEggSeventeen(null);
            stockMainBoard.setDynamicTopicsEggEighteen(null);
            stockMainBoard.setDynamicTopicsEggNineteen(null);
            stockMainBoard.setDynamicTopicsEggTwenty(null);


            //动态题材彩蛋显示1、动态题材显示2、动态题材显示3、动态题材显示4、动态题材显示5、动态题材显示6、动态题材显示7、动态题材显示8、动态题材显示9、动态题材显示10
            stockMainBoard.setDynamicTopicsShowEggOne(null);
            stockMainBoard.setDynamicTopicsShowEggTwo(null);
            stockMainBoard.setDynamicTopicsShowEggThree(null);
            stockMainBoard.setDynamicTopicsShowEggFour(null);
            stockMainBoard.setDynamicTopicsShowEggFive(null);
            stockMainBoard.setDynamicTopicsShowEggSix(null);
            stockMainBoard.setDynamicTopicsShowEggSeven(null);
            stockMainBoard.setDynamicTopicsShowEggEight(null);
            stockMainBoard.setDynamicTopicsShowEggNine(null);
            stockMainBoard.setDynamicTopicsShowEggTen(null);
            stockMainBoard.setDynamicTopicsShowEggEleven(null);
            stockMainBoard.setDynamicTopicsShowEggTwelve(null);
            stockMainBoard.setDynamicTopicsShowEggThirteen(null);
            stockMainBoard.setDynamicTopicsShowEggFourteen(null);
            stockMainBoard.setDynamicTopicsShowEggFifteen(null);
            stockMainBoard.setDynamicTopicsShowEggSixteen(null);
            stockMainBoard.setDynamicTopicsShowEggSeventeen(null);
            stockMainBoard.setDynamicTopicsShowEggEighteen(null);
            stockMainBoard.setDynamicTopicsShowEggNineteen(null);
            stockMainBoard.setDynamicTopicsShowEggTwenty(null);


            //动态彩蛋题材详细显示全部、动态题材详细显示1、动态题材详细显示2、动态题材详细显示3、动态题材详细显示4、动态题材详细显示5、动态题材详细显示6、动态题材详细显示7、动态题材详细显示8、动态题材详细显示9、动态题材详细显示10
            stockMainBoard.setDynamicTopicsDetailShowEggAll(null);
            stockMainBoard.setDynamicTopicsDetailShowEggOne(null);
            stockMainBoard.setDynamicTopicsDetailShowEggTwo(null);
            stockMainBoard.setDynamicTopicsDetailShowEggThree(null);
            stockMainBoard.setDynamicTopicsDetailShowEggFour(null);
            stockMainBoard.setDynamicTopicsDetailShowEggFive(null);
            stockMainBoard.setDynamicTopicsDetailShowEggSix(null);
            stockMainBoard.setDynamicTopicsDetailShowEggSeven(null);
            stockMainBoard.setDynamicTopicsDetailShowEggEight(null);
            stockMainBoard.setDynamicTopicsDetailShowEggNine(null);
            stockMainBoard.setDynamicTopicsDetailShowEggTen(null);
            stockMainBoard.setDynamicTopicsDetailShowEggEleven(null);
            stockMainBoard.setDynamicTopicsDetailShowEggTwelve(null);
            stockMainBoard.setDynamicTopicsDetailShowEggThirteen(null);
            stockMainBoard.setDynamicTopicsDetailShowEggFourteen(null);
            stockMainBoard.setDynamicTopicsDetailShowEggFifteen(null);
            stockMainBoard.setDynamicTopicsDetailShowEggSixteen(null);
            stockMainBoard.setDynamicTopicsDetailShowEggSeventeen(null);
            stockMainBoard.setDynamicTopicsDetailShowEggEighteen(null);
            stockMainBoard.setDynamicTopicsDetailShowEggNineteen(null);
            stockMainBoard.setDynamicTopicsDetailShowEggTwenty(null);

            //开盘啦创业板参与龙头一
            stockMainBoard.setSecondDragonTimeOne(null);
            stockMainBoard.setSecondDragonDetailOne(null);
            stockMainBoard.setSecondDragonDetailReasonOne(null);
            //开盘啦创业板参与龙头二
            stockMainBoard.setSecondDragonTimeTwo(null);
            stockMainBoard.setSecondDragonDetailTwo(null);
            stockMainBoard.setSecondDragonDetailReasonTwo(null);
            //开盘啦创业板参与龙头二
            stockMainBoard.setSecondDragonTimeThree(null);
            stockMainBoard.setSecondDragonDetailThree(null);
            stockMainBoard.setSecondDragonDetailReasonThree(null);
            //开盘啦龙一
            stockMainBoard.setDragonTimeOne(null);
            stockMainBoard.setDragonDetailOne(null);
            stockMainBoard.setDragonDetailReasonOne(null);
            //开盘啦龙二
            stockMainBoard.setDragonTimeTwo(null);
            stockMainBoard.setDragonDetailTwo(null);
            stockMainBoard.setDragonDetailReasonTwo(null);
            //开盘啦龙三
            stockMainBoard.setDragonTimeThree(null);
            stockMainBoard.setDragonDetailThree(null);
            stockMainBoard.setDragonDetailReasonThree(null);
            //开盘啦龙头题材
            stockMainBoard.setDragonTopicsStatus(null);
            stockMainBoard.setDragonTopicsOne(null);
            stockMainBoard.setDragonTopicsTwo(null);
            stockMainBoard.setDragonTopicsThree(null);
            stockMainBoard.setDragonTopicsFour(null);
            stockMainBoard.setDragonTopicsFive(null);
            stockMainBoard.setDragonTopicsSix(null);
            stockMainBoard.setDragonTopicsSeven(null);
            stockMainBoard.setDragonTopicsEight(null);
            stockMainBoard.setDragonTopicsNine(null);
            stockMainBoard.setDragonTopicsTen(null);

            //顶你
            stockMainBoard.setTopBoardTime(null);
            stockMainBoard.setTopBoardDetail(null);

            //挺你
            stockMainBoard.setStandBoardTime(null);
            stockMainBoard.setStandBoardDetail(null);

            //辣你
            stockMainBoard.setChiliTime(null);
            stockMainBoard.setChiliDetail(null);

            //靓你
            stockMainBoard.setPrettyTime(null);
            stockMainBoard.setPrettyDetail(null);

            //赞你
            stockMainBoard.setSupportBoardTime(null);
            stockMainBoard.setSupportBoardDetail(null);

            //钢你
            stockMainBoard.setRebarTime(null);
            stockMainBoard.setRebarDetail(null);

            //硬你
            stockMainBoard.setHardBoardTime(null);
            stockMainBoard.setHardBoardDetail(null);

            //狂热
            stockMainBoard.setCrazeTime(null);
            stockMainBoard.setCrazeDetail(null);
            //炽热
            stockMainBoard.setFervorTime(null);
            stockMainBoard.setFervorDetail(null);

            //龙虎榜
            stockMainBoard.setSeat(null);

            stockMainBoardCustomService.updateStockMainBoard(stockMainBoard);
        }

        //统计板块涨幅排序涨停股票、统计板块涨停个数股票排序涨停排序、火炮战、包围战。
        List<StockMainBoard> fourStockMainBoardList = oneStockMainBoardList.stream().filter(stockMainBoard -> {
            boolean m = stockMainBoard.getSectorMarkupSortStock() == null ? false : true;
            boolean n = stockMainBoard.getSectorMarkupAllSortStock() == null ? false : true;
            boolean o = stockMainBoard.getSectorArkupStockCountSort() == null ? false : true;
            return m || n || o;
        }).collect(Collectors.toList());
        for (StockMainBoard stockMainBoard : fourStockMainBoardList) {
            Long maindId = stockMainBoard.getMainId();
            Long aa = 493L;
            if (maindId.equals(aa)) {
                System.out.println();
            }
            //清空统计板块涨幅排序涨停股票
            stockMainBoard.setSectorMarkupSortStock("-");
            //清空统计板块涨幅排序涨停股票所有
            stockMainBoard.setSectorMarkupAllSortStock("-");
            //清空统计板块涨停个数股票排序涨停排序
            stockMainBoard.setSectorArkupStockCountSort("-");
            stockMainBoardService.updateStockMainBoard(stockMainBoard);

        }
        StockMainBoardDetail stockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> oneStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(stockMainBoardDetail);

        // 步骤1：分组统计每个主订单的详情数量
        List<Long> masterIdsToDelete = oneStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId,  // 按主订单ID分组
                        Collectors.counting()           // 计算每组的详情数量
                )).entrySet().stream().filter(entry -> entry.getValue() >= 30)  // 过滤数量>30的订单
                .map(entry -> entry.getKey()).collect(Collectors.toList());


        // 步骤2：批量删除订单详情（先删从表）
        Map<Long, List<StockMainBoardDetail>> oneStockMainBoardDetailListMap = oneStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.toList()));
        for (Map.Entry<Long, List<StockMainBoardDetail>> longListEntry : oneStockMainBoardDetailListMap.entrySet()) {
            Long key = longListEntry.getKey();

            Long maindId = key;
            Long aa = 773L;
            if (maindId.equals(aa)) {
                System.out.println();
            }
            if (masterIdsToDelete.contains(key)) {
                longListEntry.getValue().forEach(cc -> {
                    stockMainBoardDetailService.deleteStockMainBoardDetailByDetailId(cc.getDetailId());
                });
                stockMainBoardService.deleteStockMainBoardByMainId(key);
            }
        }


    }


    /**
     * /第二步：设置股票价格和天数
     */
    public void batchPDMainBoardInfoData() throws IOException {

        //判断是否为周末，如果是周末则不执行生成天数和价格
        Date nowDate = DateUtils.getNowDate();
        LocalDate localDateOne = nowDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        DayOfWeek dayOfWeek = localDateOne.getDayOfWeek();
        boolean isWeekend = dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY ? false : true;
        //价格要在晚上七点之后生成
        LocalTime now = LocalTime.now();
        // 定义晚上七点的时间
        LocalTime threePM = LocalTime.of(15, 0);
        boolean isThreePM = now.isAfter(threePM);
        if (isWeekend && isThreePM) {
            //读取excel文件
            ClassLoader classLoader = StockMainBoardOneController.class.getClassLoader();
            //主板
            URL oneResource = classLoader.getResource("stockfile/stockMain.xlsx");
            //创业板
//            URL twoResource = classLoader.getResource("stockfile/stockSecond.xlsx");
            List<StockMainBoard> oneList = new ArrayList<>();
            //主板
            if (oneResource != null) {
                String fileName = oneResource.getPath();
                EasyExcel.read(fileName, StockMainBoard.class, new PageReadListener<StockMainBoard>(dataList -> {
                    for (StockMainBoard stockMainBoard : dataList) {
                        if (stockMainBoard.getStockCode().startsWith("60")) {
                            stockMainBoard.setStockCode("sh" + stockMainBoard.getStockCode());
                            oneList.add(stockMainBoard);
                        } else if (stockMainBoard.getStockCode().startsWith("00")) {
                            stockMainBoard.setStockCode("sz" + stockMainBoard.getStockCode());
                            oneList.add(stockMainBoard);
                        } else {
                            oneList.add(stockMainBoard);
                        }
                    }
                })).sheet().doRead();
            } else {
                System.out.println("Resource not found");
            }

//            //创业板
//            if (twoResource != null) {
//                String fileName = twoResource.getPath();
//                EasyExcel.read(fileName, StockMainBoard.class, new PageReadListener<StockMainBoard>(dataList -> {
//                    for (StockMainBoard stockMainBoard : dataList) {
//                        if (stockMainBoard.getStockCode().startsWith("60")) {
//                            stockMainBoard.setStockCode("sh" + stockMainBoard.getStockCode());
//                            oneList.add(stockMainBoard);
//                        } else if (stockMainBoard.getStockCode().startsWith("30")) {
//                            stockMainBoard.setStockCode("sz" + stockMainBoard.getStockCode());
//                            oneList.add(stockMainBoard);
//                        } else {
//                            oneList.add(stockMainBoard);
//                        }
//                    }
//                })).sheet().doRead();
//            } else {
//                System.out.println("Resource not found");
//            }

            List<String> twoList = oneList.stream().map(StockMainBoard::getStockCode).collect(Collectors.toList());
            // 创建固定大小的线程池
            ExecutorService executor = Executors.newFixedThreadPool(THREAD_COUNT);
            // 将参数分成批次
            List<List<String>> batches = createBatches(twoList, BATCH_SIZE);
            // 提交每个批次的任务到线程池
            List<Future<HttpResponse<String>>> futures = new ArrayList<>();
            for (List<String> batch : batches) {
                futures.add(executor.submit(new RequestTask(batch)));
            }
            // 等待所有任务完成并收集结果
            List<String> allResults = new ArrayList<>();
            for (Future<HttpResponse<String>> future : futures) {
                try {
                    HttpResponse<String> httpResponse = future.get();
                    String body = httpResponse.body();
                    allResults.add(body);
                } catch (InterruptedException | ExecutionException e) {
                    e.printStackTrace();
                }
            }

            // 关闭线程池
            executor.shutdown();

            //第一步：设置股票价格和天数
            // 用于存储最终结果的集合
            //新的涨停的股票
            List<String[]> todayLimitUpTencentList = new ArrayList<>();
            //所有的股票
            List<String[]> allTencentList = new ArrayList<>();
            for (int i = 0; i < allResults.size(); i++) {
                String body = allResults.get(i);
                // 第一次切割的分隔符
                String firstDelimiter = ";";
                // 第一次切割
                String[] firstSplitArray = body.split(firstDelimiter);
                // 对第一次切割的结果进行第二次切割
                BigDecimal oneBigDecimal = new BigDecimal(9.50);
                for (String firstSplit : firstSplitArray) {

                    String[] splitString = firstSplit.split("~");
                    if (splitString.length > 1) {
                        String stockCode = splitString[2];
                        String stockName = splitString[1];
                        //涨幅
                        String limitUpString = splitString[32];
                        //开盘价
                        String openPxString = splitString[5];
                        //最高价
                        String highPxString = splitString[33];
                        //最低价
                        String lowPxString = splitString[34];
                        //收盘价
                        String tempValue = splitString[35];
                        String lastPxString = tempValue.substring(0, tempValue.indexOf("/"));


                        BigDecimal limitUp = new BigDecimal(limitUpString);
                        // 今天涨停的股票
                        if (limitUp.compareTo(oneBigDecimal) >= 0) {
                            String[] todayLimitUpTencenArray = new String[]{stockCode, stockName, limitUpString, openPxString, highPxString, lowPxString, lastPxString};
                            todayLimitUpTencentList.add(todayLimitUpTencenArray);
                        }
                        // 所有的股票
                        String[] allTencentArray = new String[]{stockCode, stockName, limitUpString, openPxString, highPxString, lowPxString, lastPxString};
                        allTencentList.add(allTencentArray);
                    }
                }
            }

            //新增主板股票
            Map<String, String> oneStockMainBoardMap = new HashMap<>();
            StockMainBoard oneSelectStockMainBoard = new StockMainBoard();
            List<StockMainBoard> oneStockMainBoardList = stockMainBoardService.selectStockMainBoardList(oneSelectStockMainBoard);
            oneStockMainBoardList.stream().forEach(stockMainBoard -> {
                String stockCode = stockMainBoard.getStockCode();
                oneStockMainBoardMap.put(stockCode, stockMainBoard.getStockName());
            });
            //新增主板股票
            todayLimitUpTencentList.stream().forEach(array -> {
                String stockCode = array[0];
                String stockName = array[1];
                if (!oneStockMainBoardMap.containsKey(stockCode)) {
                    StockMainBoard stockMainBoard = new StockMainBoard();
                    //股票类型
                    if (stockCode.startsWith("30")) {
                        stockMainBoard.setStockType("2");
                    } else {
                        stockMainBoard.setStockType("1");
                    }
                    stockMainBoard.setStockCode(stockCode);
                    stockMainBoard.setStockName(stockName);
                    stockMainBoardService.insertStockMainBoard(stockMainBoard);
                }
            });

            //查询最新的主板股票
            StockMainBoard twoSelectStockMainBoard = new StockMainBoard();
            List<StockMainBoard> twoStockMainBoardList = stockMainBoardService.selectStockMainBoardList(twoSelectStockMainBoard);
            Map<String, Long> codeToMainIdMap = twoStockMainBoardList.stream().collect(Collectors.toMap(StockMainBoard::getStockCode, StockMainBoard::getMainId));
            //新增主板股票详细
            List<StockMainBoardDetail> stockMainBoardDetailList = new ArrayList<StockMainBoardDetail>();
            allTencentList.stream().forEach(array -> {
                StockMainBoardDetail detail = new StockMainBoardDetail();
                //股票代码
                String stockCode = array[0];
                //涨幅
                String limitUpString = array[2];
                //开盘价
                String openPxString = array[3];
                //最高价
                String highPxString = array[4];
                //最低价
                String lowPxString = array[5];
                //收盘价
                String lastPxString = array[6];
                Long mainId = codeToMainIdMap.get(stockCode);
                if (mainId != null) {
                    detail.setMainId(mainId);
                    //涨幅
                    detail.setLimitUp(new BigDecimal(limitUpString));
                    //开盘价
                    detail.setOpenPx(new BigDecimal(openPxString));
                    //最高价
                    detail.setHighPx(new BigDecimal(highPxString));
                    //最低价
                    detail.setLowPx(new BigDecimal(lowPxString));
                    //收盘价
                    detail.setLastPx(new BigDecimal(lastPxString));
                    detail.setCreateTime(DateUtils.getNowDate());
                    stockMainBoardDetailList.add(detail);
                }

            });

            for (int i = 0; i < stockMainBoardDetailList.size(); i++) {
                StockMainBoardDetail detail = stockMainBoardDetailList.get(i);
                StockMainBoardDetail selectDetail = new StockMainBoardDetail();
                selectDetail.setMainId(detail.getMainId());
                List<StockMainBoardDetail> detailList = stockMainBoardDetailService.selectStockMainBoardDetailList(selectDetail);
                //数据库是空状态
                if (detailList.isEmpty()) {
                    detail.setDay(1L);
                    detail.setUpdateTime(DateUtils.getNowDate());
                    stockMainBoardDetailService.insertStockMainBoardDetail(detail);
                } else {
                    Optional<StockMainBoardDetail> maxDateObject = detailList.stream().max(Comparator.comparing(StockMainBoardDetail::getCreateTime));
                    StockMainBoardDetail maxDateObjectDatail = maxDateObject.get();
                    Date createTime = maxDateObjectDatail.getCreateTime();
                    // 使用 Calendar 类来解析 Date 对象
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTime(createTime);

                    int year = calendar.get(Calendar.YEAR);
                    int month = calendar.get(Calendar.MONTH) + 1; // 月份从0开始，所以需要加1
                    int day = calendar.get(Calendar.DAY_OF_MONTH);
                    LocalDate localDate = LocalDate.of(year, month, day);
                    boolean areDateTimesEqual = localDate.isEqual(LocalDate.now());
                    if (!areDateTimesEqual) {
                        OptionalInt max = detailList.stream().mapToInt(s -> {
                            Long getDay = s.getDay();
                            int b = getDay.intValue();
                            Integer i2 = Integer.valueOf(b);
                            return i2;
                        }).max();
                        int asInt = max.getAsInt();
                        detail.setDay((long) asInt + 1);
                        detail.setCreateTime(DateUtils.getNowDate());
                        stockMainBoardDetailService.insertStockMainBoardDetail(detail);
                    }
                }
            }
        }

    }


    /**
     * /第三步：设置主板股票主要基本信息数据
     */

    public void batchMainBoardInfoData() throws IOException {

//        //获取所有主板股票详细数据
//        StockMainBoardDetail stockMainBoardDetail = new StockMainBoardDetail();
//        List<StockMainBoardDetail> oneStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(stockMainBoardDetail);
//
//        // 统计每个mainId的出现次数
//        Map<Long, Long> mainIdCount = oneStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.counting()));
//
//        // 获取mainId出现次数大于等于5的
//        List<StockMainBoardDetail> twoStockMainBoardDetailList = oneStockMainBoardDetailList.stream().filter(s1 -> mainIdCount.get(s1.getMainId()) >= 5).collect(Collectors.toList());
//
//        //集合大小减去1
//        Map<Long, List<StockMainBoardDetail>> threeStockMainBoardDetailMap = twoStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.collectingAndThen(Collectors.toList(), s -> s.size() <= 1 ? s : s.subList(0, s.size() - 1))));
//
//        //统计基本信息的满足值的条件
//        Map<Long, Boolean[]> fourBooleanMap = new HashMap<>();
//        //下降幅度统计
//        Map<Long, List<Object[]>> rangeObjectMap = new HashMap<>();
//
//
//        //集合中连续三个数以及三个数以上之间的差值为15以上，直到满足条件就终止计算
//        for (Map.Entry<Long, List<StockMainBoardDetail>> entry : threeStockMainBoardDetailMap.entrySet()) {
//            Long key = entry.getKey();
//            Long aa = 1079L;
//            if (key.equals(aa)) {
//                System.out.println("key = " + key + ", value = " + entry.getValue());
//            }
//            Boolean[] boolArray = {false, false, false, false, false};
//
//
//            List<StockMainBoardDetail> stockMainBoardDetailList = entry.getValue();
//            int minCount = 3;
//            //逆转、偷袭、猛攻(0)
//            BigDecimal reversionThresholdOne = new BigDecimal(-19);
//            BigDecimal reversionThresholdTwo = new BigDecimal(-70);
//            //布阵、袭击、冲锋(1)
//            BigDecimal breakThresholdOne = new BigDecimal(-14);
//            BigDecimal breakThresholdTwo = new BigDecimal(-18);
//            //侦查、确夺、争夺(2)
//            BigDecimal contendThresholdOne = new BigDecimal(-11);
//            BigDecimal contendThresholdTwo = new BigDecimal(-13);
//            //热身、左拳、右拳(3)
//            BigDecimal readyThresholdOne = new BigDecimal(-2);
//            BigDecimal readyThresholdTwo = new BigDecimal(-10);
//            //巷战(4)
//
//            for (int i = 0; i <= stockMainBoardDetailList.size() - minCount; i++) {
//                for (int j = i + 1; j < stockMainBoardDetailList.size(); j++) {
//                    StockMainBoardDetail lastDetail = stockMainBoardDetailList.get(j);
//                    BigDecimal lastStockPrice = lastDetail.getLastPx();
//                    StockMainBoardDetail previousDetail = stockMainBoardDetailList.get(i);
//                    BigDecimal previousStockPrice = previousDetail.getLastPx();
//                    BigDecimal twoincrease = (lastStockPrice.subtract(previousStockPrice)).divide(previousStockPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
//
//                    if (j - i >= minCount - 1 && twoincrease.compareTo(reversionThresholdTwo) >= 0 && twoincrease.compareTo(reversionThresholdOne) <= 0) {
//                        //逆转
//                        boolArray[0] = true;
//                        //下降幅度
//                        List<Object[]> rangeMapList = rangeObjectMap.get(key) == null ? new ArrayList<>() : rangeObjectMap.get(key);
//                        Object[] rangeMaObject = new Object[]{true, false, false, false, twoincrease, previousDetail, lastDetail};
//                        rangeMapList.add(rangeMaObject);
//                        rangeObjectMap.put(key, rangeMapList);
//
//                    } else if (j - i >= minCount - 1 && twoincrease.compareTo(breakThresholdTwo) >= 0 && twoincrease.compareTo(breakThresholdOne) <= 0 && !boolArray[0]) {
//                        //布阵、袭击、冲锋
//                        boolArray[1] = true;
//                        //下降幅度
//                        List<Object[]> rangeMapList = rangeObjectMap.get(key) == null ? new ArrayList<>() : rangeObjectMap.get(key);
//                        Object[] rangeMaObject = new Object[]{false, true, false, false, twoincrease, previousDetail, lastDetail};
//                        rangeMapList.add(rangeMaObject);
//                        rangeObjectMap.put(key, rangeMapList);
//                    } else if (j - i >= minCount - 1 && twoincrease.compareTo(contendThresholdTwo) >= 0 && twoincrease.compareTo(contendThresholdOne) <= 0 && !boolArray[0] && !boolArray[1]) {
//                        //侦查、确夺、争夺
//                        boolArray[2] = true;
//                        //下降幅度
//                        List<Object[]> rangeMapList = rangeObjectMap.get(key) == null ? new ArrayList<>() : rangeObjectMap.get(key);
//                        Object[] rangeMaObject = new Object[]{false, false, true, false, twoincrease, previousDetail, lastDetail};
//                        rangeMapList.add(rangeMaObject);
//                        rangeObjectMap.put(key, rangeMapList);
//                    } else if (j - i >= minCount - 1 && twoincrease.compareTo(readyThresholdTwo) >= 0 && twoincrease.compareTo(readyThresholdOne) <= 0 && !boolArray[0] && !boolArray[1] && !boolArray[2]) {
//                        //热身、左拳、右拳
//                        boolArray[3] = true;
//                        //下降幅度
//                        List<Object[]> rangeMapList = rangeObjectMap.get(key) == null ? new ArrayList<>() : rangeObjectMap.get(key);
//                        Object[] rangeMaObject = new Object[]{false, false, false, true, twoincrease, previousDetail, lastDetail};
//                        rangeMapList.add(rangeMaObject);
//                        rangeObjectMap.put(key, rangeMapList);
//                    } else if ((j - i >= minCount - 1) && !boolArray[0] && !boolArray[1] && !boolArray[2] && !boolArray[3]) {
//                        //巷战
//                        boolArray[4] = true;
//                    }
//                }
//            }
//            //重新设置基础信息，以最大的为准
//            for (int i = 0; i < boolArray.length; i++) {
//                Boolean isBoolArray = boolArray[i];
//                if (i == 0 && isBoolArray) {
//                    boolArray[1] = false;
//                    boolArray[2] = false;
//                    boolArray[3] = false;
//                    boolArray[4] = false;
//                    break;
//                } else if (i == 1 && isBoolArray) {
//                    boolArray[0] = false;
//                    boolArray[2] = false;
//                    boolArray[3] = false;
//                    boolArray[4] = false;
//                    break;
//                } else if (i == 2 && isBoolArray) {
//                    boolArray[0] = false;
//                    boolArray[1] = false;
//                    boolArray[3] = false;
//                    boolArray[4] = false;
//                    break;
//                } else if (i == 3 && isBoolArray) {
//                    boolArray[0] = false;
//                    boolArray[1] = false;
//                    boolArray[2] = false;
//                    boolArray[4] = false;
//                    break;
//                } else if (i == 4 && isBoolArray) {
//                    boolArray[0] = false;
//                    boolArray[1] = false;
//                    boolArray[2] = false;
//                    boolArray[3] = false;
//                    break;
//                }
//            }
//            fourBooleanMap.put(entry.getKey(), boolArray);
//
//        }
//
//        //下降幅度最多值
//        String dateFormat = "MM/dd";
//        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
//        rangeObjectMap.entrySet().stream().forEach(entry -> {
//            Long maindId = entry.getKey();
//            Long aa = 1079L;
//            if (maindId.equals(aa)) {
//                System.out.println("maindId = " + maindId + ", value = " + entry.getValue());
//            }
//            List<Object[]> rangeMapList = entry.getValue();
//            //获取下降幅度最大值
//            Optional<Object[]> fallMaxOptional = rangeMapList.stream().min(Comparator.comparing(obj -> ((BigDecimal) obj[4]).doubleValue()));
//            Object[] fallMaxArray = fallMaxOptional.get();
//            Object fallMaxObject = fallMaxArray[4];
//            Optional<Object[]> max = rangeMapList.stream().filter(obj -> {
//                boolean equals = obj[4].equals(fallMaxObject);
//                return equals;
//            }).max(Comparator.comparing(obj -> {
//                StockMainBoardDetail lastDetail = (StockMainBoardDetail) obj[6];
//                return lastDetail.getCreateTime();
//            }));
//
//            Object[] objects = max.get();
//            Boolean one = (Boolean) objects[0];
//            Boolean two = (Boolean) objects[1];
//            Boolean three = (Boolean) objects[2];
//            Boolean four = (Boolean) objects[3];
//            BigDecimal increaseBigDecimal = (BigDecimal) objects[4];
//            StockMainBoardDetail previousDetail = (StockMainBoardDetail) objects[5];
//            Date createTimePreviousDetail = previousDetail.getCreateTime();
//            String createTimePreviousDetailString = sdf.format(createTimePreviousDetail);
//            StockMainBoardDetail lastDetail = (StockMainBoardDetail) objects[6];
//            Date createTimeLastDetail = lastDetail.getCreateTime();
//            String createTimeLastDetailString = sdf.format(createTimeLastDetail);
//            StockMainBoard stockMainBoard = new StockMainBoard();
//            stockMainBoard.setMainId(maindId);
//            //〔↘22% 02/17—01/22〕
//            int increase = Math.abs(increaseBigDecimal.intValue());
//            //猛攻、逆转下降详细、冲锋下降详细、右拳下降详细
//            if (one == true) {
//                String fallRangeDetail = "〔 ↘" + increase + "% " + createTimePreviousDetailString + "—" + createTimeLastDetailString + " 〕";
//                //逆转下降详细
//                stockMainBoard.setReversionFallRangeDetail(fallRangeDetail);
//                //猛攻下降详细
//                stockMainBoard.setFierceAttackFallRangeDetail(fallRangeDetail);
//                stockMainBoardService.updateStockMainBoard(stockMainBoard);
//            } else if (two == true) {
//                //下降详细
//                String fallRangeDetail = "〔 ↘" + increase + "% " + createTimePreviousDetailString + "—" + createTimeLastDetailString + " 〕";
//
//                //布阵下降详细
//                stockMainBoard.setEmbattleFallRangeDetail(fallRangeDetail);
//
//                //冲锋下降详细
//                stockMainBoard.setRushFallRangeDetail(fallRangeDetail);
//                stockMainBoardService.updateStockMainBoard(stockMainBoard);
//            } else if (three == true) {
//                //下降详细
//                String fallRangeDetail = "〔 ↘" + increase + "% " + createTimePreviousDetailString + "—" + createTimeLastDetailString + " 〕";
//
//                //侦查详细
//                stockMainBoard.setInvestigateFallRangeDetail(fallRangeDetail);
//
//                //勾拳下降详细
//                stockMainBoard.setHookFallRangeDetail(fallRangeDetail);
//                stockMainBoardService.updateStockMainBoard(stockMainBoard);
//            } else if (four == true) {
//                //右拳下降详细
//                String rightFistFallRangeDetail = "〔 ↘" + increase + "% " + createTimePreviousDetailString + "—" + createTimeLastDetailString + " 〕";
//                stockMainBoard.setRightFistFallRangeDetail(rightFistFallRangeDetail);
//                stockMainBoardService.updateStockMainBoard(stockMainBoard);
//            }
//        });
//
//        //map转list
//        List<StockMainBoardDetail> fourStockMainBoardDetailList = threeStockMainBoardDetailMap.values().stream().flatMap(List::stream).collect(Collectors.toList());
//
//        //获取最高价格
//        Map<Long, Object[]> fiveStockMainBoardDetailMap = fourStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.collectingAndThen(Collectors.toList(), list -> {
//            int maxIndex = -1;
//            BigDecimal maxValue = BigDecimal.valueOf(-Double.MAX_VALUE); // 使用一个足够小的BigDecimal值作为初始最大值
//            for (int i = 0; i < list.size(); i++) {
//                BigDecimal value = list.get(i).getLastPx();
//                if (value.compareTo(maxValue) > 0) { // 使用compareTo方法比较BigDecimal值
//                    maxValue = value;
//                    maxIndex = i;
//                }
//            }
//            Object[] object = new Object[2];
//            object[0] = list.get(maxIndex).getLastPx();
//            object[1] = maxIndex;
//            return object;
//        })));
//
//        //获取最后两条数据
//        Map<Long, List<StockMainBoardDetail>> sixStockMainBoardDetailMap = twoStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.collectingAndThen(Collectors.toList(), s -> s.size() <= 2 ? s : s.subList(s.size() - 2, s.size()))));
//
//        //历史价格最大值循环
//        for (Map.Entry<Long, Object[]> entry : fiveStockMainBoardDetailMap.entrySet()) {
//            Long maindId = entry.getKey();
//            Long aa = 1467L;
//            if (maindId.equals(aa)) {
//                System.out.println("maindId = " + maindId + ", value = " + entry.getValue());
//            }
//            //历史最大值
//            Object maxDetail = entry.getValue()[0];
//            BigDecimal maxDetailStockPrice = new BigDecimal(((Number) maxDetail).toString());
//            //获取最后一条数据
//            List<StockMainBoardDetail> stockMainBoardDetails1 = sixStockMainBoardDetailMap.get(maindId);
//            StockMainBoardDetail finallyDetail = stockMainBoardDetails1.get(1);
//            //最后一天详细的价格
//            BigDecimal finallyDetailPrice = finallyDetail.getLastPx();
//            //最后一天详细的时间
//            Date finallyDetailCreateTime = finallyDetail.getCreateTime();
//            //历史价格最大值和今天价格比较
//            BigDecimal oneDifferenceValue = (finallyDetailPrice.subtract(maxDetailStockPrice)).divide(maxDetailStockPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
//            BigDecimal oneCompareToPrice = new BigDecimal(3);
//            BigDecimal twoCompareToPrice = new BigDecimal(4);
//            BigDecimal threeCompareToPrice = new BigDecimal(5);
//
//            //最后两条数据比较
//            List<StockMainBoardDetail> stockMainBoardDetails = sixStockMainBoardDetailMap.get(maindId);
//            StockMainBoardDetail oneDetail = stockMainBoardDetails.get(0);
//            BigDecimal oneDetailstockPrice = oneDetail.getLastPx();
//            StockMainBoardDetail twoDetail = stockMainBoardDetails.get(1);
//            BigDecimal twoDetailstockPrice = twoDetail.getLastPx();
//            BigDecimal twoDifferenceValue = (twoDetailstockPrice.subtract(oneDetailstockPrice)).divide(oneDetailstockPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
//            BigDecimal fourCompareToPrice = new BigDecimal(9.50);
//
//            Boolean[] fourBooleanMapArarry = fourBooleanMap.get(maindId);
//            int basicInformationIndex = 0;
//            for (int i = 0; i < fourBooleanMapArarry.length; i++) {
//                if (Boolean.TRUE.equals(fourBooleanMapArarry[i])) {
//                    basicInformationIndex = i;
//                    break;
//                }
//            }
//
//            StockMainBoard mainBoard = stockMainBoardService.selectStockMainBoardByMainId(maindId);
//            if (mainBoard == null) {
//                System.out.println();
//            }
//            if (basicInformationIndex == 0 && oneDifferenceValue.compareTo(oneCompareToPrice) >= 0 && oneDifferenceValue.compareTo(twoCompareToPrice) <= 0 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //偷袭
//                //偷袭次数
//                Long sneakAttackFrequency = mainBoard.getSneakAttackFrequency();
//                //偷袭时间
//                Date sneakAttackFrequencyTime = mainBoard.getSneakAttackFrequencyTime();
//
//                if (sneakAttackFrequency == null) {
//                    mainBoard.setSneakAttackFrequency(1L);
//                    mainBoard.setSneakAttackFrequencyTime(finallyDetailCreateTime);
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = sneakAttackFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        mainBoard.setSneakAttackFrequency(sneakAttackFrequency + 1L);
//                        mainBoard.setSneakAttackFrequencyTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 0 && oneDifferenceValue.compareTo(threeCompareToPrice) >= 0 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //猛攻时间
//                Date fierceAttackFrequencyTime = mainBoard.getFierceAttackFrequencyTime();
//                //猛攻值
//                BigDecimal twoBigDecimal = new BigDecimal(10);
//                BigDecimal multiply = oneDifferenceValue.multiply(twoBigDecimal);
//                long longValue = multiply.longValue();
//                if (fierceAttackFrequencyTime == null) {
//                    //设置猛攻值
//                    mainBoard.setFierceAttackFrequencyTime(finallyDetailCreateTime);
//                    mainBoard.setFierceAttackDegree(longValue);
//                    mainBoard.setFierceAttackDegreeTime(finallyDetailCreateTime);
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = fierceAttackFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        //设置猛攻值
//                        mainBoard.setFierceAttackFrequencyTime(finallyDetailCreateTime);
//                        mainBoard.setFierceAttackDegree(longValue);
//                        mainBoard.setFierceAttackDegreeTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 0 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //逆转
//                //逆转次数
//                Long reversionFrequency = mainBoard.getReversionFrequency();
//                //逆转时间
//                Date reversionFrequencyTime = mainBoard.getReversionFrequencyTime();
//
//                if (reversionFrequency == null) {
//                    //设置逆转
//                    mainBoard.setReversionFrequency(1L);
//                    mainBoard.setReversionFrequencyTime(finallyDetailCreateTime);
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = reversionFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        //设置逆转
//                        mainBoard.setReversionFrequency(reversionFrequency + 1L);
//                        mainBoard.setReversionFrequencyTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 1 && oneDifferenceValue.compareTo(oneCompareToPrice) >= 0 && oneDifferenceValue.compareTo(twoCompareToPrice) <= 0 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //袭击
//                //袭击次数
//                Long assaultFrequency = mainBoard.getAssaultFrequency();
//                //袭击时间
//                Date assaultFrequencyTime = mainBoard.getAssaultFrequencyTime();
//
//                if (assaultFrequency == null) {
//                    mainBoard.setAssaultFrequency(1L);
//                    mainBoard.setAssaultFrequencyTime(finallyDetailCreateTime);
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = assaultFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        mainBoard.setAssaultFrequency(assaultFrequency + 1L);
//                        mainBoard.setAssaultFrequencyTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 1 && oneDifferenceValue.compareTo(threeCompareToPrice) >= 0 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //冲锋时间
//                Date rushFrequencyTime = mainBoard.getRushFrequencyTime();
//                //冲锋值
//                BigDecimal twoBigDecimal = new BigDecimal(10);
//                BigDecimal multiply = oneDifferenceValue.multiply(twoBigDecimal);
//                long longValue = multiply.longValue();
//
//                if (rushFrequencyTime == null) {
//                    //设置冲锋
//                    mainBoard.setRushFrequencyTime(finallyDetailCreateTime);
//                    mainBoard.setRushDegree(longValue);
//                    mainBoard.setRushDegreeTime(finallyDetailCreateTime);
//
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = rushFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        //设置冲锋
//                        mainBoard.setRushFrequencyTime(finallyDetailCreateTime);
//                        mainBoard.setRushDegree(longValue);
//                        mainBoard.setRushDegreeTime(finallyDetailCreateTime);
//
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 1 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //布阵时间
//                Date embattleFrequencyTime = mainBoard.getEmbattleFrequencyTime();
//                //布阵值
//                BigDecimal twoBigDecimal = new BigDecimal(10);
//                BigDecimal multiply = oneDifferenceValue.multiply(twoBigDecimal);
//                long longValue = multiply.longValue();
//
//                if (embattleFrequencyTime == null) {
//                    //设置布阵
//                    mainBoard.setEmbattleFrequencyTime(finallyDetailCreateTime);
//                    mainBoard.setEmbattleDegree(longValue);
//                    mainBoard.setEmbattleDegreeTime(finallyDetailCreateTime);
//
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = embattleFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        //设置布阵
//                        mainBoard.setEmbattleFrequencyTime(finallyDetailCreateTime);
//                        mainBoard.setEmbattleDegree(longValue);
//                        mainBoard.setEmbattleDegreeTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 2 && oneDifferenceValue.compareTo(oneCompareToPrice) >= 0 && oneDifferenceValue.compareTo(twoCompareToPrice) <= 0 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //直拳
//                //直拳次数
//                Long straightPunchFrequency = mainBoard.getStraightPunchFrequency();
//                //直拳时间
//                Date straightPunchFrequencyTime = mainBoard.getStraightPunchFrequencyTime();
//
//                if (straightPunchFrequency == null) {
//                    mainBoard.setStraightPunchFrequency(1L);
//                    mainBoard.setStraightPunchFrequencyTime(finallyDetailCreateTime);
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = straightPunchFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        mainBoard.setStraightPunchFrequency(straightPunchFrequency + 1L);
//                        mainBoard.setStraightPunchFrequencyTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 2 && oneDifferenceValue.compareTo(threeCompareToPrice) >= 0 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //勾拳时间
//                Date hookFrequencyTime = mainBoard.getHookFrequencyTime();
//                //勾拳值
//                BigDecimal twoBigDecimal = new BigDecimal(10);
//                BigDecimal multiply = oneDifferenceValue.multiply(twoBigDecimal);
//                long longValue = multiply.longValue();
//
//                if (hookFrequencyTime == null) {
//                    //设置勾拳
//                    mainBoard.setHookFrequencyTime(finallyDetailCreateTime);
//                    mainBoard.setHookDegree(longValue);
//                    mainBoard.setHookDegreeTime(finallyDetailCreateTime);
//
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = hookFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        //设置勾拳
//                        mainBoard.setHookFrequencyTime(finallyDetailCreateTime);
//                        mainBoard.setHookDegree(longValue);
//                        mainBoard.setHookDegreeTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 2 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //侦查时间
//                Date investigateFrequencyTime = mainBoard.getInvestigateFrequencyTime();
//                //侦查值
//                BigDecimal twoBigDecimal = new BigDecimal(10);
//                BigDecimal multiply = oneDifferenceValue.multiply(twoBigDecimal);
//                long longValue = multiply.longValue();
//
//                if (investigateFrequencyTime == null) {
//                    //设置侦查
//                    mainBoard.setInvestigateFrequencyTime(finallyDetailCreateTime);
//                    mainBoard.setInvestigateDegree(longValue);
//                    mainBoard.setInvestigateDegreeTime(finallyDetailCreateTime);
//
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = investigateFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        //设置侦查
//                        mainBoard.setInvestigateFrequencyTime(finallyDetailCreateTime);
//                        mainBoard.setInvestigateDegree(longValue);
//                        mainBoard.setInvestigateDegreeTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 3 && oneDifferenceValue.compareTo(oneCompareToPrice) >= 0 && oneDifferenceValue.compareTo(twoCompareToPrice) <= 0 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //左拳
//                //左拳次数
//                Long leftFistFrequency = mainBoard.getLeftFistFrequency();
//                //左拳时间
//                Date leftFistFrequencyTime = mainBoard.getLeftFistFrequencyTime();
//
//                if (leftFistFrequency == null) {
//                    mainBoard.setLeftFistFrequency(1L);
//                    mainBoard.setLeftFistFrequencyTime(finallyDetailCreateTime);
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = leftFistFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        mainBoard.setLeftFistFrequency(leftFistFrequency + 1L);
//                        mainBoard.setLeftFistFrequencyTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 3 && oneDifferenceValue.compareTo(threeCompareToPrice) >= 0 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //右拳时间
//                Date rightFistFrequencyTime = mainBoard.getRightFistFrequencyTime();
//                //右拳值
//                BigDecimal twoBigDecimal = new BigDecimal(10);
//                BigDecimal multiply = oneDifferenceValue.multiply(twoBigDecimal);
//                long longValue = multiply.longValue();
//
//                if (rightFistFrequencyTime == null) {
//                    //设置右拳
//                    mainBoard.setRightFistFrequencyTime(finallyDetailCreateTime);
//                    mainBoard.setRightFistDegree(longValue);
//                    mainBoard.setRightFistDegreeTime(finallyDetailCreateTime);
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = rightFistFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        //设置右拳
//                        mainBoard.setRightFistFrequencyTime(finallyDetailCreateTime);
//                        mainBoard.setRightFistDegree(longValue);
//                        mainBoard.setRightFistDegreeTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            } else if (basicInformationIndex == 3 && twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
//                //热身
//                //热身次数
//                Long warmUpFrequency = mainBoard.getWarmUpFrequency();
//                //热身时间
//                Date warmUpFrequencyTime = mainBoard.getWarmUpFrequencyTime();
//
//                if (warmUpFrequency == null) {
//                    mainBoard.setWarmUpFrequency(1L);
//                    mainBoard.setWarmUpFrequencyTime(finallyDetailCreateTime);
//                    stockMainBoardService.updateStockMainBoard(mainBoard);
//                } else {
//                    LocalDate localDateOne = warmUpFrequencyTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    LocalDate localDateTwo = finallyDetailCreateTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
//                    boolean isEqualYearMonthDay = !localDateOne.equals(localDateTwo);
//                    if (isEqualYearMonthDay) {
//                        mainBoard.setWarmUpFrequency(warmUpFrequency + 1L);
//                        mainBoard.setWarmUpFrequencyTime(finallyDetailCreateTime);
//                        stockMainBoardService.updateStockMainBoard(mainBoard);
//                    }
//                }
//            }
//
//        }

        //查询最新的主板股票
        StockMainBoard threeSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> threeStockMainBoardList = stockMainBoardService.selectStockMainBoardList(threeSelectStockMainBoard);

        //获取所有主板股票详细数据
        StockMainBoardDetail fiveStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> fiveStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(fiveStockMainBoardDetail);
        //根据主板id分组最后两条详细数据
        Map<Long, List<StockMainBoardDetail>> secondToLastStockMainBoardDetailMap = fiveStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.collectingAndThen(Collectors.toList(), s -> s.size() <= 1 ? s : s.subList(s.size() - 2, s.size()))));
        //龙虎榜数据
        for (StockMainBoard stockMainBoard : threeStockMainBoardList) {
            String stockCode = stockMainBoard.getStockCode();
            if (stockCode.equals("600980")) {
                System.out.println();
            }
            String threeUrl = "https://apphwhq.longhuvip.com/w1/api/index.php";
            String threeJson = "a=GetStockPanKou_Narrow&c=StockL2Data&PhoneOSNew=1&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e&VerSion=5.18.0.2&apiv=w39&StockID=" + stockCode + "&State=1&";
            // 设置请求头
            HashMap<String, String> threeHeaders = new HashMap<>();
            threeHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            threeHeaders.put("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 9; NX627J Build/PQ3B.190801.01161429)");
            threeHeaders.put("Host", "apphwhq.longhuvip.com");
            threeHeaders.put("Connection", "Keep-Alive");
            threeHeaders.put("Accept-Encoding", "gzip");
            String threeContent = HttpClientUtil.doPost(threeUrl, threeJson, threeHeaders);
            JSONObject threeJsonObject = JSON.parseObject(threeContent);
            JSONObject realJsonObject = threeJsonObject.getJSONObject("real");

            //实际流通市
            String actualcirculationValueString = realJsonObject.getString("actualcirculation_value");
            BigDecimal actualcirculationValueBigDecimal = new BigDecimal(actualcirculationValueString);
            BigDecimal threeDecimal = new BigDecimal(100000000);
            BigDecimal actualcirculationValue = actualcirculationValueBigDecimal.divide(threeDecimal, 2, BigDecimal.ROUND_HALF_UP);

            Long mainId = stockMainBoard.getMainId();
            List<StockMainBoardDetail> stockMainBoardDetails = secondToLastStockMainBoardDetailMap.get(mainId);
            if (stockMainBoardDetails == null) {
                System.out.println();
            }
            StockMainBoardDetail oneDetail = stockMainBoardDetails.get(0);
            BigDecimal oneDetailstockPrice = oneDetail.getLastPx();

            if (stockMainBoardDetails.size() == 1) {
                //实际流通市值
                stockMainBoard.setActualCirculationValue(actualcirculationValue);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
            } else {
                StockMainBoardDetail twoDetail = stockMainBoardDetails.get(1);
                BigDecimal twoDetailstockPrice = twoDetail.getLastPx();
                BigDecimal twoDifferenceValue = (twoDetailstockPrice.subtract(oneDetailstockPrice)).divide(oneDetailstockPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
                BigDecimal fourCompareToPrice = new BigDecimal(9.50);
                if (twoDifferenceValue.compareTo(fourCompareToPrice) >= 0) {
                    //实际流通市值
                    stockMainBoard.setActualCirculationValue(actualcirculationValue);
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                }
            }
        }


        for (StockMainBoard stockMainBoard : threeStockMainBoardList) {
            String stockCode = stockMainBoard.getStockCode();
            Long mainId = stockMainBoard.getMainId();
            if (stockCode.equals("300872")) {
                System.out.println();
            }
            String stockID = stockMainBoard.getStockCode();

            List<StockMainBoardDetail> stockMainBoardDetails = secondToLastStockMainBoardDetailMap.get(mainId);
            StockMainBoardDetail oneDetail = stockMainBoardDetails.get(0);
            BigDecimal oneDetailstockPrice = oneDetail.getLastPx();
            if (stockMainBoardDetails.size() == 1) {
                //设置统计板块涨幅排序涨停股票、统计板块涨停个数股票排序涨停排序
                String[] sectorMarkupSortBystockID = SectorMarkupSortUtils.getSectorMarkupSortBystockID(stockID);
                if (StringUtils.isNotEmpty(sectorMarkupSortBystockID)) {
                    String sectorMarkupSort = sectorMarkupSortBystockID[0];
                    String sectorMarkupSortALLBystock = sectorMarkupSortBystockID[1];
                    String sectorMarkupSortBystock = sectorMarkupSortBystockID[2];
                    String dynamicTopicsDetailShowAll = sectorMarkupSortBystockID[3];
                    String sectorAllDragonSortStock = sectorMarkupSortBystockID[4];

                    stockMainBoard.setSectorMarkupSortStock(sectorMarkupSort);
                    stockMainBoard.setSectorMarkupAllSortStock(sectorMarkupSortALLBystock);
                    stockMainBoard.setSectorArkupStockCountSort(sectorMarkupSortBystock);
                    stockMainBoard.setSectorDragonMarkupAllSortStock(sectorAllDragonSortStock);
                    //动态题材详细显示全部
                    stockMainBoard.setDynamicTopicsDetailShowAll(dynamicTopicsDetailShowAll);
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                }
            } else {
                //设置统计板块涨幅排序涨停股票、统计板块涨停个数股票排序涨停排序
                String[] sectorMarkupSortBystockID = SectorMarkupSortUtils.getSectorMarkupSortBystockID(stockID);
                if (StringUtils.isNotEmpty(sectorMarkupSortBystockID)) {
                    String sectorMarkupSort = sectorMarkupSortBystockID[0];
                    String sectorMarkupSortALLBystock = sectorMarkupSortBystockID[1];
                    String sectorMarkupSortBystock = sectorMarkupSortBystockID[2];
                    String dynamicTopicsDetailShowAll = sectorMarkupSortBystockID[3];
                    String sectorAllDragonSortStock = sectorMarkupSortBystockID[4];

                    stockMainBoard.setSectorMarkupSortStock(sectorMarkupSort);
                    stockMainBoard.setSectorMarkupAllSortStock(sectorMarkupSortALLBystock);
                    stockMainBoard.setSectorArkupStockCountSort(sectorMarkupSortBystock);
                    stockMainBoard.setSectorDragonMarkupAllSortStock(sectorAllDragonSortStock);
                    //动态题材详细显示全部
                    stockMainBoard.setDynamicTopicsDetailShowAll(dynamicTopicsDetailShowAll);
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);

                }
            }
        }


    }


    /**
     * 第五步：设置开盘啦数据
     *
     * @throws IOException
     */
    public void batchKaiPanLaDataOne() throws IOException {
        //龙虎榜数据
        String oneUrl = "https://applhb.longhuvip.com/w1/api/index.php";
        String oneJson = "st=500&a=GetStockList&c=LongHuBang&PhoneOSNew=1&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e&VerSion=5.17.0.2&Token=0&Time=&Index=0&apiv=w38&Type=2&UserID=0&";
        // 设置请求头
        HashMap<String, String> oneHeaders = new HashMap<>();
        oneHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        oneHeaders.put("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 9; NX627J Build/PQ3B.190801.01161429)");
        oneHeaders.put("Host", "applhb.longhuvip.com");
        oneHeaders.put("Connection", "Keep-Alive");
        oneHeaders.put("Accept-Encoding", "gzip");

        String oneContent = HttpClientUtil.doPost(oneUrl, oneJson, oneHeaders);
        JSONObject jsonObject = JSON.parseObject(oneContent);

        //龙虎榜时间
        String kplLhbTime = jsonObject.getString("Time");
        //开盘啦概念创建时间
        String dateFormat = "yyyy-MM-dd";
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        // 将字符串解析为日期对象
        Date setKplLhbTime = null;
        try {
            setKplLhbTime = sdf.parse(kplLhbTime);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }

        // 风口概念
        JSONObject fkgnJSONObject = jsonObject.getJSONObject("fkgn");
        List<Map<String, Map<String, Object>>> fkgnList = new ArrayList<>();
        Map<String, Map<String, Object>> outerMap = new HashMap<>();
        for (String key : fkgnJSONObject.keySet()) {
            Object value = fkgnJSONObject.get(key);
            if (value instanceof JSONObject) {
                // 将内层 JSONObject 转为 Map<String, Object>
                Map<String, Object> innerMap = fkgnJSONObject.getJSONObject(key).toJavaObject(Map.class);
                outerMap.put(key, innerMap);
            }
        }
        fkgnList.add(outerMap);

        // 风口概念: 排序
        JSONObject kgsortJSONObject = jsonObject.getJSONObject("kgSort");
        List<Map<String, Object>> kgSortList = new ArrayList<>();
        for (String key : kgsortJSONObject.keySet()) {
            JSONArray innerObj = kgsortJSONObject.getJSONArray(key);
            HashMap<String, Object> objectObjectHashMap = new HashMap<>();
            objectObjectHashMap.put(key, innerObj);
            kgSortList.add(objectObjectHashMap); // 内层对象转 Map
        }

        /** 股票详细 */
        JSONArray listJSONObject = jsonObject.getJSONArray("list");

        //设置概念
        for (int k = 0; k < listJSONObject.size(); k++) {
            JSONObject detail = listJSONObject.getJSONObject(k);
            //股票代码
            String stockCode = (String) detail.get("ID");
            //股票涨幅
            String increaseAmountString = detail.get("IncreaseAmount").toString();
            String increaseAmountSubString = increaseAmountString.substring(0, increaseAmountString.length() - 1);
            BigDecimal oneIncreaseAmount = new BigDecimal(increaseAmountSubString);
            BigDecimal twoIncreaseAmount = new BigDecimal(9.50);
            for (int i = 0; i < kgSortList.size(); i++) {
                Map<String, Object> kgSort = kgSortList.get(i);
                Object six = kgSort.get(stockCode);
                JSONArray sixJSONArray = (JSONArray) six;

                if (stockCode.equals("000566")) {
                    System.out.println();
                }
                //风口概念
                if (sixJSONArray != null) {
                    Integer[] sortArray = IntStream.range(0, sixJSONArray.size()).mapToObj(c -> sixJSONArray.getInteger(c)) // 或 getInt(i)// int → Integer
                            .toArray(Integer[]::new);

                    String concept = "";
                    for (int j = 0; j < fkgnList.size(); j++) {
                        Map<String, Map<String, Object>> fkgnListMap = fkgnList.get(j);
                        //板块名称
                        Map<String, Object> sectorNameMap = fkgnListMap.get(stockCode);
                        if (sectorNameMap != null) {
                            for (int a = 0; a < sortArray.length; a++) {
                                Integer value = sortArray[a];
                                if (a != sortArray.length - 1) {
                                    concept += (String) sectorNameMap.get(Integer.valueOf(value)) + "+";
                                } else {
                                    concept += (String) sectorNameMap.get(Integer.valueOf(value));
                                }
                            }
                        }
                    }

                    //查询风口概念
                    StockMainBoard selectStockMainBoardOne = new StockMainBoard();
                    selectStockMainBoardOne.setStockCode(stockCode);
                    List<StockMainBoard> list = stockMainBoardService.selectStockMainBoardList(selectStockMainBoardOne);
                    if (list.size() != 0 && oneIncreaseAmount.compareTo(twoIncreaseAmount) >= 0) {
                        StockMainBoard mainBoard = list.get(0);
                        //风口概念
                        mainBoard.setConcept(concept);
                        mainBoard.setConceptTime(setKplLhbTime);
                        stockMainBoardService.updateStockMainBoard(mainBoard);
                    }
                }
            }
        }


        //设置空缺的概念、是否有创业板
        StockMainBoard oneSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> oneStockMainBoardList = stockMainBoardService.selectStockMainBoardList(oneSelectStockMainBoard);
        //查询详细
        StockMainBoardDetail oneStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> oneStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(oneStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> oneStockMainBoardDetailMap = oneStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.collectingAndThen(Collectors.toList(), s -> s.size() <= 2 ? s : s.subList(s.size() - 3, s.size()))));
        for (StockMainBoard stockMainBoard : oneStockMainBoardList) {
            Long mainId = stockMainBoard.getMainId();
            String concept = stockMainBoard.getConcept();
            String sectorMarkupAllSortStock = stockMainBoard.getSectorMarkupAllSortStock();
            String stockCode = stockMainBoard.getStockCode();

            if (stockCode.equals("603716")) {
                System.out.println();
            }

            //设置空缺的概念
            if ((StringUtils.isEmpty(concept) && StringUtils.isNotEmpty(sectorMarkupAllSortStock)) || StringUtils.isEmpty(concept) && StringUtils.isNotEmpty(sectorMarkupAllSortStock)) {
                List<StockMainBoardDetail> stockMainBoardDetailList = oneStockMainBoardDetailMap.get(mainId);
                if (stockMainBoardDetailList != null && stockMainBoardDetailList.size() == 1) {
                    String[] splitsectorMarkupSortStock = sectorMarkupAllSortStock.split("<p><b>");
                    String twoConcept = "";
                    for (int i = 0; i < splitsectorMarkupSortStock.length; i++) {
                        String one = splitsectorMarkupSortStock[i];
                        int onelastIndex = one.lastIndexOf("(");
                        if (i >= 1) {
                            if (i != splitsectorMarkupSortStock.length - 1) {
                                twoConcept += one.substring(0, onelastIndex) + "+";
                            } else {
                                twoConcept += one.substring(0, onelastIndex);
                            }
                        }
                    }
                    stockMainBoard.setConcept(twoConcept);
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (stockMainBoardDetailList != null && stockMainBoardDetailList.size() >= 2) {
                    //获取最后一条数据
                    StockMainBoardDetail lastOneStockMainBoardDetail = stockMainBoardDetailList.get(stockMainBoardDetailList.size() - 1);
                    BigDecimal oneStockPrice = lastOneStockMainBoardDetail.getLastPx();
                    //获取最后二条数据
                    StockMainBoardDetail lastTwoStockMainBoardDetail = stockMainBoardDetailList.get(stockMainBoardDetailList.size() - 2);
                    BigDecimal twoStockPrice = lastTwoStockMainBoardDetail.getLastPx();

                    BigDecimal oneIncrease = (oneStockPrice.subtract(twoStockPrice)).divide(twoStockPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
                    BigDecimal twoBigDecimal = new BigDecimal(9.50);

                    if (oneIncrease.compareTo(twoBigDecimal) >= 0) {
                        String[] splitsectorMarkupSortStock = sectorMarkupAllSortStock.split("<p><b>");
                        String threeConcept = "";
                        for (int i = 0; i < splitsectorMarkupSortStock.length; i++) {
                            String one = splitsectorMarkupSortStock[i];
                            int onelastIndex = one.lastIndexOf("(");
                            if (i >= 1) {
                                if (i != splitsectorMarkupSortStock.length - 1) {
                                    threeConcept += one.substring(0, onelastIndex) + "+";
                                } else {
                                    threeConcept += one.substring(0, onelastIndex);
                                }
                            }
                        }
                        stockMainBoard.setConcept(threeConcept);
                        stockMainBoardService.updateStockMainBoard(stockMainBoard);
                    }
                }
            }
        }

        //设置涨停原因
        //查询股票
        StockMainBoard threeSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> threeStockMainBoardList = stockMainBoardService.selectStockMainBoardList(threeSelectStockMainBoard);
        //查询详细
        StockMainBoardDetail threeStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> threeStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(threeStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> threeStockMainBoardDetailMap = threeStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.collectingAndThen(Collectors.toList(), s -> s.size() <= 2 ? s : s.subList(s.size() - 3, s.size()))));
        for (StockMainBoard stockMainBoard : threeStockMainBoardList) {
            Long mainId = stockMainBoard.getMainId();
            String stockCode = stockMainBoard.getStockCode();
            List<StockMainBoardDetail> stockMainBoardDetailList = threeStockMainBoardDetailMap.get(mainId);
            if (stockMainBoardDetailList != null && stockMainBoardDetailList.size() == 1) {
                String threeUrl = "https://apphwhq.longhuvip.com/w1/api/index.php";
                String threeJson = "a=GetKLineZhangTing&apiv=w40&c=StockLineData&StockID=" + stockCode + "&PhoneOSNew=1&UserID=2692604&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e&VerSion=5.19.0.0&Token=d3ba72277b381ee11f3b9f3087e1cee8&";
                // 设置请求头
                HashMap<String, String> threeHeaders = new HashMap<>();
                threeHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
                threeHeaders.put("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 9; NX627J Build/PQ3B.190801.01161429)");
                threeHeaders.put("Host", "apphwhq.longhuvip.com");
                threeHeaders.put("Connection", "Keep-Alive");
                threeHeaders.put("Accept-Encoding", "gzip");
                String threeContent = HttpClientUtil.doPost(threeUrl, threeJson, threeHeaders);
                JSONObject threeContentObject = JSON.parseObject(threeContent);
                JSONArray dataJSONArray = threeContentObject.getJSONArray("List");
                if (dataJSONArray.size() > 0) {
                    JSONObject jSONObject = dataJSONArray.getJSONObject(0);
                    String oneReason = jSONObject.getString("Reason");
                    String oneGNSM = jSONObject.getString("GNSM");
                    String dragonString = jSONObject.getString("SCLT");
                    String dragon = dragonString.replaceAll("日内龙", "");

                    String[] oneReasonSplit = oneReason.split("；");
                    //涨停原因
                    stockMainBoard.setLimitUpReason(oneReason);
                    //涨停原因板块
                    stockMainBoard.setLimitUpReasonSector(oneReasonSplit[0]);
                    //涨停原因详细
                    String limitUpReasonDetail = oneReasonSplit.length == 1 ? oneGNSM : oneReasonSplit[1];
                    stockMainBoard.setLimitUpReasonDetail(limitUpReasonDetail);
                    //涨停原因龙几
                    stockMainBoard.setLimitUpReasonDragon(dragon);
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                }

            } else if (stockMainBoardDetailList != null && stockMainBoardDetailList.size() >= 2) {
                //获取最后一条数据
                StockMainBoardDetail lastOneStockMainBoardDetail = stockMainBoardDetailList.get(stockMainBoardDetailList.size() - 1);
                BigDecimal oneStockPrice = lastOneStockMainBoardDetail.getLastPx();
                //获取最后二条数据
                StockMainBoardDetail lastTwoStockMainBoardDetail = stockMainBoardDetailList.get(stockMainBoardDetailList.size() - 2);
                BigDecimal twoStockPrice = lastTwoStockMainBoardDetail.getLastPx();

                BigDecimal oneIncrease = (oneStockPrice.subtract(twoStockPrice)).divide(twoStockPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
                BigDecimal twoBigDecimal = new BigDecimal(9.50);

                //
                if (oneIncrease.compareTo(twoBigDecimal) >= 0) {
                    String threeUrl = "https://apphwhq.longhuvip.com/w1/api/index.php";
                    String threeJson = "a=GetKLineZhangTing&apiv=w40&c=StockLineData&StockID=" + stockCode + "&PhoneOSNew=1&UserID=2692604&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e&VerSion=5.19.0.0&Token=d3ba72277b381ee11f3b9f3087e1cee8&";
                    // 设置请求头
                    HashMap<String, String> threeHeaders = new HashMap<>();
                    threeHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
                    threeHeaders.put("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 9; NX627J Build/PQ3B.190801.01161429)");
                    threeHeaders.put("Host", "apphwhq.longhuvip.com");
                    threeHeaders.put("Connection", "Keep-Alive");
                    threeHeaders.put("Accept-Encoding", "gzip");
                    String threeContent = HttpClientUtil.doPost(threeUrl, threeJson, threeHeaders);
                    JSONObject threeContentObject = JSON.parseObject(threeContent);
                    JSONArray dataJSONArray = threeContentObject.getJSONArray("List");
                    if (dataJSONArray.size() > 0) {
                        JSONObject jSONObject = dataJSONArray.getJSONObject(0);
                        String oneReason = jSONObject.getString("Reason");
                        String oneGNSM = jSONObject.getString("GNSM");
                        String dragonString = jSONObject.getString("SCLT");
                        String dragon = dragonString.replaceAll("日内龙", "");

                        String[] oneReasonSplit = oneReason.split("；");
                        //涨停原因
                        stockMainBoard.setLimitUpReason(oneReason);
                        //涨停原因板块
                        stockMainBoard.setLimitUpReasonSector(oneReasonSplit[0]);
                        //涨停原因详细
                        //涨停原因详细
                        String limitUpReasonDetail = oneReasonSplit.length == 1 ? oneGNSM : oneReasonSplit[1];
                        stockMainBoard.setLimitUpReasonDetail(limitUpReasonDetail);
                        //涨停原因龙几
                        stockMainBoard.setLimitUpReasonDragon(dragon);
                        stockMainBoardService.updateStockMainBoard(stockMainBoard);
                    }
                }
            }

        }

        //固定题材：主板、创业板
        SysDictData sysDictData = new SysDictData();
        sysDictData.setDictType("fix_topics_status");
        List<SysDictData> sysDictDataOneList = dictDataService.selectDictDataList(sysDictData);
        //查询主板股票
        StockMainBoard sixSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> sixStockMainBoardList = stockMainBoardService.selectStockMainBoardList(sixSelectStockMainBoard);
        List<StockMainBoard> sixStockMainBoardFilterList = sixStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).collect(Collectors.toList());

        //获取统计板块涨幅排序涨停股票取所有
        HashMap<String, String> sixSectorMarkupSortStockHashMap = new HashMap<>();
        for (StockMainBoard stockMainBoard : sixStockMainBoardFilterList) {
            //所有
            String sectorMarkupAllSortStock = stockMainBoard.getSectorMarkupAllSortStock();
            String[] onesplitString = sectorMarkupAllSortStock.split("<p><b>");
            for (String onesplit : onesplitString) {
                String[] towSplit = onesplit.split(":");
                if (StringUtils.isNotEmpty(towSplit[0])) {
                    String threeString = towSplit[0];
                    String[] threeSplitString = threeString.split("\\(");
                    sixSectorMarkupSortStockHashMap.put(threeSplitString[0], towSplit[1]);
                }
            }
        }

        //主板map
        Map<String, List<StockMainBoard>> sevenStockMainBoardMap = sixStockMainBoardFilterList.stream().collect(Collectors.groupingBy(a -> {
            String stockNameString = a.getStockName();
            String modified = stockNameString.replaceAll(" ", "").trim();
            return modified;
        }));

        //设置固定题材
        for (int j = 0; j < sysDictDataOneList.size(); j++) {
            SysDictData twoSysDictData = sysDictDataOneList.get(j);
            //字典键值
            String dictValue = twoSysDictData.getDictValue();
            //字典标签
            String dictLabel = twoSysDictData.getDictLabel();

            List<String> matchedValues = sixSectorMarkupSortStockHashMap.entrySet().stream().filter(entry -> entry.getKey().contains(dictLabel) || dictLabel.contains(entry.getKey()))  // 使用contains判断模糊包含
                    .map(Map.Entry::getValue).collect(Collectors.toList());
            for (String matchedValue : matchedValues) {
                String[] oneSplitString = matchedValue.split("&nbsp;&nbsp;&nbsp;");
                for (int i = 0; i < oneSplitString.length; i++) {
                    if (i != 0 && i != oneSplitString.length - 1) {
                        String twoSplitString = oneSplitString[i];
                        String[] threeSplitString = twoSplitString.split(" ");
                        String fourSplitString = threeSplitString[0];
                        StockMainBoard mainBoard = new StockMainBoard();
                        mainBoard.setStockName(fourSplitString);
                        if (fourSplitString.equals("莱百股份")) {
                            System.out.println();
                        }

                        List<StockMainBoard> stockMainBoards = sevenStockMainBoardMap.get(fourSplitString);
                        if (stockMainBoards == null) {
                            continue;
                        }
                        if (stockMainBoards.size() > 0) {
                            if (dictValue.equals("1")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsOne("1");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            } else if (dictValue.equals("2")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsTwo("2");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            } else if (dictValue.equals("3")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsThree("3");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            } else if (dictValue.equals("4")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsFour("4");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            } else if (dictValue.equals("5")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsFive("5");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            } else if (dictValue.equals("6")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsSix("6");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            } else if (dictValue.equals("7")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsSeven("7");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            } else if (dictValue.equals("8")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsEight("8");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            } else if (dictValue.equals("9")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsNine("9");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            } else if (dictValue.equals("10")) {
                                StockMainBoard oneMainBoard = stockMainBoards.get(0);
                                oneMainBoard.setFixTopicsTen("10");
                                stockMainBoardService.updateStockMainBoard(oneMainBoard);
                            }
                        }
                    }
                }
            }
        }

        //龙头：主板
        //查询主板
        StockMainBoard sevenSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> sevenStockMainBoardList = stockMainBoardService.selectStockMainBoardList(sevenSelectStockMainBoard);
        List<StockMainBoard> sevenStockMainBoardFilterList = sevenStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).filter(a -> a.getStockType().equals("1")).collect(Collectors.toList());
        //查询详细
        StockMainBoardDetail fiveStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> fiveStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(fiveStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> fiveStockMainBoardDetailMap = fiveStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.collectingAndThen(Collectors.toList(), s -> s.size() == 1 ? s : s.subList(s.size() - 1, s.size()))));
        //不参与的板块
        String[] dragonStringArray = {"浙江", "江苏省", "上海", "重庆市", "高股息", "破净股概念", "高股息精选", "举牌", "一季报增长", "业绩增长", "超跌", "专精特新", "杭州", "福建", "地方国企", "贬值受益", "四川省", "成都市", "年报增长", "国有企业", "股权转让", "平台经济", "一带一路", "电子商务", "汽车类", "汽车零部件", "新能源汽车", "汽车充电", "充电桩", "碳中和", "鸡肉", "猪肉", "实控人变更", "农业", "农药", "并购重组", "环保"};
        List<String> dragonExcludeList = Arrays.asList(dragonStringArray);
        for (StockMainBoard stockMainBoard : sevenStockMainBoardFilterList) {
            //股票代码
            String stockCode = stockMainBoard.getStockCode();
            if (stockCode.equals("002272")) {
                System.out.println();
            }
            //股票名称
            String oneStockNameString = stockMainBoard.getStockName();
            String oneStockName = oneStockNameString.replaceAll(" ", "").trim();
            //爆发原因
            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
            String[] oneSplit = dynamicTopicsDetailShowAll.split(":  ; ");

            ArrayList<String> oneReason = new ArrayList<>();
            for (String twoStr : oneSplit) {
                if (twoStr.contains(": ")) {
                    String[] twoSplit = twoStr.split("; ");
                    for (int i = 0; i < twoSplit.length; i++) {
                        String threeValue = twoSplit[i];
                        if (threeValue.contains(": ")) {
                            oneReason.add(threeValue);
                        }
                    }
                }
            }

            Long mainId = stockMainBoard.getMainId();
            List<StockMainBoardDetail> stockMainBoardDetails = fiveStockMainBoardDetailMap.get(mainId);
            StockMainBoardDetail detail = stockMainBoardDetails.get(0);
            //详细时间
            Date createTime = detail.getCreateTime();
            //所有板块
            String sectorDragonMarkupAllSortStock = stockMainBoard.getSectorDragonMarkupAllSortStock();
            String[] onesplitString = sectorDragonMarkupAllSortStock.split("<p><b>");
            //龙头
            String oneDragonSecondString = "";
            String twoDragonSecondString = "";
            String threeDragonSecondString = "";
            String oneDragonString = "";
            String twoDragonString = "";
            String threeDragonString = "";
            for (String onesplit : onesplitString) {
                String[] towSplit = onesplit.split(":");
                if (StringUtils.isNotEmpty(towSplit[0])) {
                    //板块名称
                    String threeString = towSplit[0];
                    String[] threeSplitString = threeString.split("\\(");
                    String sector = threeSplitString[0];
                    //股票名称
                    String[] fourSplitString = towSplit[1].split("&nbsp;&nbsp;&nbsp;");

                    //是否包含创业板的股票
                    AtomicReference<Boolean> isContainSecond = new AtomicReference<>(false);
                    List<String> filteredList = Arrays.stream(fourSplitString).filter(str -> {
                        String[] oneSplitString = str.split(" ");
                        if (oneSplitString.length == 3) {
                            String limitUpString = oneSplitString[2];
                            String limitUp = limitUpString.substring(0, limitUpString.length() - 1);
                            if (new BigDecimal(limitUp).compareTo(new BigDecimal(19.50)) >= 0) {
                                isContainSecond.set(true);
                                return false;
                            } else {
                                return true;
                            }
                        }
                        return true;
                    }).collect(Collectors.toList());

                    //包含创业板的龙头
                    if (isContainSecond.get()) {
                        for (int i = 0; i < filteredList.size(); i++) {
                            String oneString = filteredList.get(i);
                            String[] twoSplitString = oneString.split(" ");
                            if (twoSplitString.length == 3) {
                                //股票名称
                                String twoStockName = twoSplitString[0];
                                //龙几
                                String dragon = twoSplitString[1];
                                if (oneStockName.equals(twoStockName)) {
                                    if (i == 1 && dragon.contains("龙")) {
                                        if (!dragonExcludeList.contains(sector)) {
                                            oneDragonSecondString += sector + "; ";
                                        }
                                    } else if (i == 2 && dragon.contains("龙")) {
                                        if (!dragonExcludeList.contains(sector)) {
                                            twoDragonSecondString += sector + "; ";
                                        }
                                    } else if (i == 3 && dragon.contains("龙")) {
                                        if (!dragonExcludeList.contains(sector)) {
                                            threeDragonSecondString += sector + "; ";
                                        }
                                    }
                                }
                            }
                        }
                    } else {
                        for (int i = 0; i < fourSplitString.length; i++) {
                            String fiveSplitString = fourSplitString[i];
                            String[] sixSplitString = fiveSplitString.split(" ");
                            if (sixSplitString.length == 3) {
                                //股票名称
                                String twoStockName = sixSplitString[0];
                                if ("妙可蓝多".equals(twoStockName)) {
                                    System.out.println();
                                }
                                //龙几
                                String dragon = sixSplitString[1];
                                if (oneStockName.equals(twoStockName)) {
                                    if (dragon.equals("龙一")) {
                                        if (!dragonExcludeList.contains(sector)) {
                                            oneDragonString += sector + "; ";
                                        }
                                    } else if (dragon.equals("龙二")) {
                                        if (!dragonExcludeList.contains(sector)) {
                                            twoDragonString += sector + "; ";
                                        }
                                    } else if (dragon.equals("龙三")) {
                                        if (!dragonExcludeList.contains(sector)) {
                                            threeDragonString += sector + "; ";
                                        }
                                    }

                                    //设置创业板没有涨停的股票的主板股票龙头
                                    if (StringUtils.isEmpty(oneDragonSecondString) && StringUtils.isEmpty(twoDragonSecondString) && StringUtils.isEmpty(threeDragonSecondString) && StringUtils.isEmpty(oneDragonString) && StringUtils.isEmpty(twoDragonString) && StringUtils.isEmpty(threeDragonString) && dragon.contains("龙") && i == 1) {
                                        if (!dragonExcludeList.contains(sector)) {
                                            oneDragonSecondString += sector + "; ";
                                        }
                                    } else if (StringUtils.isNotEmpty(oneDragonSecondString) && StringUtils.isEmpty(twoDragonSecondString) && StringUtils.isEmpty(threeDragonSecondString) && StringUtils.isEmpty(oneDragonString) && StringUtils.isEmpty(twoDragonString) && StringUtils.isEmpty(threeDragonString) && dragon.contains("龙") && i == 2) {
                                        if (!dragonExcludeList.contains(sector)) {
                                            twoDragonSecondString += sector + "; ";
                                        }
                                    } else if (StringUtils.isNotEmpty(oneDragonSecondString) && StringUtils.isNotEmpty(twoDragonSecondString) && StringUtils.isEmpty(threeDragonSecondString) && StringUtils.isEmpty(oneDragonString) && StringUtils.isEmpty(twoDragonString) && StringUtils.isEmpty(threeDragonString) && dragon.contains("龙") && i == 3) {
                                        if (!dragonExcludeList.contains(sector)) {
                                            threeDragonSecondString += sector + "; ";
                                        }
                                    }

                                }
                            }
                        }
                    }
                }
            }

            //主板龙头和时间
            //主板原因
            //包含创业板的主板龙头
            if (StringUtils.isNotEmpty(oneDragonSecondString)) {
                String kplDragonDetailReason = "";
                String[] dragonSplit = oneDragonSecondString.split("; ");
                for (String dragon : dragonSplit) {
                    for (int i = 0; i < oneReason.size(); i++) {
                        String reason = oneReason.get(i);
                        if (reason.contains(dragon)) {
                            kplDragonDetailReason += reason;
                            break;
                        }
                    }
                }
                stockMainBoard.setSecondDragonTimeOne(createTime);
                String kplDragonDetail = oneDragonSecondString.endsWith("; ") ? oneDragonSecondString.substring(0, oneDragonSecondString.length() - 2) : oneDragonSecondString;
                stockMainBoard.setSecondDragonDetailOne(kplDragonDetail);
                stockMainBoard.setSecondDragonDetailReasonOne(kplDragonDetailReason);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);

            } else if (StringUtils.isNotEmpty(twoDragonSecondString)) {
                String kplDragonDetailReason = "";
                String[] dragonSplit = twoDragonSecondString.split("; ");
                for (String dragon : dragonSplit) {
                    for (int i = 0; i < oneReason.size(); i++) {
                        String reason = oneReason.get(i);
                        if (reason.contains(dragon)) {
                            kplDragonDetailReason += reason;
                            break;
                        }
                    }
                }
                stockMainBoard.setSecondDragonTimeTwo(createTime);
                String kplDragonDetail = twoDragonSecondString.endsWith("; ") ? twoDragonSecondString.substring(0, twoDragonSecondString.length() - 2) : twoDragonSecondString;
                stockMainBoard.setSecondDragonDetailTwo(kplDragonDetail);
                stockMainBoard.setSecondDragonDetailReasonTwo(kplDragonDetailReason);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);

            } else if (StringUtils.isNotEmpty(threeDragonSecondString)) {
                String kplDragonDetailReason = "";
                String[] dragonSplit = threeDragonSecondString.split("; ");
                for (String dragon : dragonSplit) {
                    for (int i = 0; i < oneReason.size(); i++) {
                        String reason = oneReason.get(i);
                        if (reason.contains(dragon)) {
                            kplDragonDetailReason += reason;
                            break;
                        }
                    }
                }
                stockMainBoard.setSecondDragonTimeThree(createTime);
                String kplDragonDetail = threeDragonSecondString.endsWith("; ") ? threeDragonSecondString.substring(0, threeDragonSecondString.length() - 2) : threeDragonSecondString;
                stockMainBoard.setSecondDragonDetailThree(kplDragonDetail);
                stockMainBoard.setSecondDragonDetailReasonThree(kplDragonDetailReason);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
                //不包含创业板的龙头
            } else if (StringUtils.isNotEmpty(oneDragonString)) {
                String kplDragonDetailReason = "";
                String[] dragonSplit = oneDragonString.split("; ");
                for (String dragon : dragonSplit) {
                    for (int i = 0; i < oneReason.size(); i++) {
                        String reason = oneReason.get(i);
                        if (reason.contains(dragon)) {
                            kplDragonDetailReason += reason;
                            break;
                        }
                    }
                }
                stockMainBoard.setDragonTimeOne(createTime);
                String oneDragon = oneDragonString.endsWith("; ") ? oneDragonString.substring(0, oneDragonString.length() - 2) : oneDragonString;
                stockMainBoard.setDragonDetailOne(oneDragon);
                stockMainBoard.setDragonDetailReasonOne(kplDragonDetailReason);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);

            } else if (StringUtils.isNotEmpty(twoDragonString)) {
                String kplDragonDetailReason = "";
                String[] dragonSplit = twoDragonString.split("; ");
                for (String dragon : dragonSplit) {
                    for (int i = 0; i < oneReason.size(); i++) {
                        String reason = oneReason.get(i);
                        if (reason.contains(dragon)) {
                            kplDragonDetailReason += reason;
                            break;
                        }
                    }
                }
                stockMainBoard.setDragonTimeTwo(createTime);
                String twoDragon = twoDragonString.endsWith("; ") ? twoDragonString.substring(0, twoDragonString.length() - 2) : twoDragonString;
                stockMainBoard.setDragonDetailTwo(twoDragon);
                stockMainBoard.setDragonDetailReasonTwo(kplDragonDetailReason);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);

            } else if (StringUtils.isNotEmpty(threeDragonString)) {
                String kplDragonDetailReason = "";
                String[] dragonSplit = threeDragonString.split("; ");
                for (String dragon : dragonSplit) {
                    for (int i = 0; i < oneReason.size(); i++) {
                        String reason = oneReason.get(i);
                        if (reason.contains(dragon)) {
                            kplDragonDetailReason += reason;
                            break;
                        }
                    }
                }
                stockMainBoard.setDragonTimeThree(createTime);
                String threeDragon = threeDragonString.endsWith("; ") ? threeDragonString.substring(0, threeDragonString.length() - 2) : threeDragonString;
                stockMainBoard.setDragonDetailThree(threeDragon);
                stockMainBoard.setDragonDetailReasonThree(kplDragonDetailReason);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
            }

        }

        //龙头：创业板
        //查询创业板
        StockMainBoard elevenSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> elevenStockMainBoardList = stockMainBoardService.selectStockMainBoardList(elevenSelectStockMainBoard);
        List<StockMainBoard> elevenStockMainBoardFilterList = elevenStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).filter(a -> a.getStockType().equals("2")).collect(Collectors.toList());
        //查询详细
        StockMainBoardDetail thirteenStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> thirteenStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(thirteenStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> thirteenStockMainBoardDetailMap = thirteenStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.collectingAndThen(Collectors.toList(), s -> s.size() == 1 ? s : s.subList(s.size() - 1, s.size()))));

        for (StockMainBoard stockMainBoard : elevenStockMainBoardFilterList) {
            //股票代码
            String stockCode = stockMainBoard.getStockCode();
            if (stockCode.equals("603212")) {
                System.out.println();
            }
            //股票名称
            String oneStockNameString = stockMainBoard.getStockName();
            String oneStockName = oneStockNameString.replaceAll(" ", "").trim();
            //爆发原因
            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
            String[] oneSplit = dynamicTopicsDetailShowAll.split(":  ; ");

            ArrayList<String> oneReason = new ArrayList<>();
            for (String twoStr : oneSplit) {
                if (twoStr.contains(": ")) {
                    String[] twoSplit = twoStr.split("; ");
                    for (int i = 0; i < twoSplit.length; i++) {
                        String threeValue = twoSplit[i];
                        if (threeValue.contains(": ")) {
                            oneReason.add(threeValue);
                        }
                    }
                }
            }

            Long mainId = stockMainBoard.getMainId();
            List<StockMainBoardDetail> stockMainBoardDetails = thirteenStockMainBoardDetailMap.get(mainId);
            StockMainBoardDetail detail = stockMainBoardDetails.get(0);
            //详细时间
            Date createTime = detail.getCreateTime();
            //所有板块
            String sectorDragonMarkupAllSortStock = stockMainBoard.getSectorDragonMarkupAllSortStock();
            String[] onesplitString = sectorDragonMarkupAllSortStock.split("<p><b>");
            //龙头
            String oneDragonSecondString = "";
            String twoDragonSecondString = "";
            String threeDragonSecondString = "";
            for (String onesplit : onesplitString) {
                String[] towSplit = onesplit.split(":");
                if (StringUtils.isNotEmpty(towSplit[0])) {
                    //板块名称
                    String threeString = towSplit[0];
                    String[] threeSplitString = threeString.split("\\(");
                    String sector = threeSplitString[0];
                    //股票名称
                    String[] fourSplitString = towSplit[1].split("&nbsp;&nbsp;&nbsp;");
                    for (int i = 0; i < fourSplitString.length; i++) {
                        String fiveSplitString = fourSplitString[i];
                        String[] sixSplitString = fiveSplitString.split(" ");
                        if (sixSplitString.length == 3) {
                            //股票名称
                            String twoStockName = sixSplitString[0];
                            if ("妙可蓝多".equals(twoStockName)) {
                                System.out.println();
                            }
                            //龙几
                            String dragon = sixSplitString[1];
                            if (oneStockName.equals(twoStockName)) {
                                if (dragon.equals("龙一")) {
                                    if (!dragonExcludeList.contains(sector)) {
                                        oneDragonSecondString += sector + "; ";
                                    }
                                } else if (dragon.equals("龙二")) {
                                    if (!dragonExcludeList.contains(sector)) {
                                        twoDragonSecondString += sector + "; ";
                                    }
                                } else if (dragon.equals("龙三")) {
                                    if (!dragonExcludeList.contains(sector)) {
                                        threeDragonSecondString += sector + "; ";
                                    }
                                }
                            }
                        }
                    }
                }
            }

            //主板龙头和时间
            //主板原因
            //包含创业板的主板龙头
            if (StringUtils.isNotEmpty(oneDragonSecondString)) {
                String kplDragonDetailReason = "";
                String[] dragonSplit = oneDragonSecondString.split("; ");
                for (String dragon : dragonSplit) {
                    for (int i = 0; i < oneReason.size(); i++) {
                        String reason = oneReason.get(i);
                        if (reason.contains(dragon)) {
                            kplDragonDetailReason += reason;
                            break;
                        }
                    }
                }
                stockMainBoard.setSecondDragonTimeOne(createTime);
                String kplDragonDetail = oneDragonSecondString.endsWith("; ") ? oneDragonSecondString.substring(0, oneDragonSecondString.length() - 2) : oneDragonSecondString;
                stockMainBoard.setSecondDragonDetailOne(kplDragonDetail);
                stockMainBoard.setSecondDragonDetailReasonOne(kplDragonDetailReason);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);

            } else if (StringUtils.isNotEmpty(twoDragonSecondString)) {
                String kplDragonDetailReason = "";
                String[] dragonSplit = twoDragonSecondString.split("; ");
                for (String dragon : dragonSplit) {
                    for (int i = 0; i < oneReason.size(); i++) {
                        String reason = oneReason.get(i);
                        if (reason.contains(dragon)) {
                            kplDragonDetailReason += reason;
                            break;
                        }
                    }
                }
                stockMainBoard.setSecondDragonTimeTwo(createTime);
                String kplDragonDetail = twoDragonSecondString.endsWith("; ") ? twoDragonSecondString.substring(0, twoDragonSecondString.length() - 2) : twoDragonSecondString;
                stockMainBoard.setSecondDragonDetailTwo(kplDragonDetail);
                stockMainBoard.setSecondDragonDetailReasonTwo(kplDragonDetailReason);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);

            } else if (StringUtils.isNotEmpty(threeDragonSecondString)) {
                String kplDragonDetailReason = "";
                String[] dragonSplit = threeDragonSecondString.split("; ");
                for (String dragon : dragonSplit) {
                    for (int i = 0; i < oneReason.size(); i++) {
                        String reason = oneReason.get(i);
                        if (reason.contains(dragon)) {
                            kplDragonDetailReason += reason;
                            break;
                        }
                    }
                }
                stockMainBoard.setSecondDragonTimeThree(createTime);
                String kplDragonDetail = threeDragonSecondString.endsWith("; ") ? threeDragonSecondString.substring(0, threeDragonSecondString.length() - 2) : threeDragonSecondString;
                stockMainBoard.setSecondDragonDetailThree(kplDragonDetail);
                stockMainBoard.setSecondDragonDetailReasonThree(kplDragonDetailReason);
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
            }
        }


    }


    /**
     * 第六步：设置开盘啦数据二
     *
     * @throws IOException
     */
    public void batchKaiPanLaDataTwo() throws IOException {

        //设置主板二的动态板块查询
        //查询主板
        StockMainBoard sevenSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> sevenStockMainBoardList = stockMainBoardService.selectStockMainBoardList(sevenSelectStockMainBoard);
        List<StockMainBoard> sevenStockMainBoardFilterList = sevenStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).filter(a -> {
            String secondDragonDetailOne = a.getSecondDragonDetailOne();
            String secondDragonDetailTwo = a.getSecondDragonDetailTwo();
            String secondDragonDetailThree = a.getSecondDragonDetailThree();
            String dragonDetailOne = a.getDragonDetailOne();
            String dragonDetailTwo = a.getDragonDetailTwo();
            String dragonDetailThree = a.getDragonDetailThree();
            return StringUtils.isNotEmpty(secondDragonDetailOne) || StringUtils.isNotEmpty(secondDragonDetailTwo) || StringUtils.isNotEmpty(secondDragonDetailThree) || StringUtils.isNotEmpty(dragonDetailOne) || StringUtils.isNotEmpty(dragonDetailTwo) || StringUtils.isNotEmpty(dragonDetailThree);
        }).collect(Collectors.toList());
        List<String> oneDragonList = sevenStockMainBoardFilterList.stream().map(a -> {
            String secondDragonDetailOne = a.getSecondDragonDetailOne();
            String secondDragonDetailTwo = a.getSecondDragonDetailTwo();
            String secondDragonDetailThree = a.getSecondDragonDetailThree();
            String dragonDetailOne = a.getDragonDetailOne();
            String dragonDetailTwo = a.getDragonDetailTwo();
            String dragonDetailThree = a.getDragonDetailThree();
            return secondDragonDetailOne + "; " + secondDragonDetailTwo + "; " + secondDragonDetailThree + "; " + dragonDetailOne + "; " + dragonDetailTwo + "; " + dragonDetailThree;
        }).collect(Collectors.toList());
        List<String> twoDragonList = new ArrayList<>();
        oneDragonList.stream().forEach(a -> {
            String[] split = a.split("; ");
            for (int i = 0; i < split.length; i++) {
                String one = split[i];
                if (!one.equals("null")) {
                    twoDragonList.add(one);
                }
            }
        });
        Map<String, Long> frequencyMap = twoDragonList.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));

        LinkedHashMap<String, Long> frequencySortedMap = frequencyMap.entrySet().stream().sorted((e1, e2) -> e2.getValue().compareTo(e1.getValue())) // 按值倒序排序
                .limit(10) // 取前十个元素
                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldVal, newVal) -> oldVal, LinkedHashMap::new));

        //删除开盘啦龙头题材库
        SysDictData dragonMainSysDictData = new SysDictData();
        dragonMainSysDictData.setDictType("dragon_topics_status");
        List<SysDictData> dragonMainSysDictDataOneList = dictDataService.selectDictDataList(dragonMainSysDictData);
        String dragonIdsString = dragonMainSysDictDataOneList.stream().map(a -> a.getDictCode()).map(String::valueOf).collect(Collectors.joining(","));
        dictDataService.deleteDictDataByIds(dragonIdsString);
        //设置开盘啦龙头题材库
        Long dictSortValue = 1L;
        for (Map.Entry<String, Long> oneEntry : frequencySortedMap.entrySet()) {
            String key = oneEntry.getKey();
            Long valueString = oneEntry.getValue();
            String dictLabel = key + "(" + valueString + "只" + ")";
            SysDictData oneSysDictData = new SysDictData();
            oneSysDictData.setDictType("dragon_topics_status");
            oneSysDictData.setDictLabel(dictLabel);
            oneSysDictData.setDictSort(dictSortValue);
            oneSysDictData.setDictValue(String.valueOf(dictSortValue));
            dictDataService.insertDictData(oneSysDictData);
            dictSortValue++;
        }

        //查询开盘啦龙头题材库
        SysDictData twoMainSysDictData = new SysDictData();
        twoMainSysDictData.setDictType("dragon_topics_status");
        List<SysDictData> twoMainSysDictDataOneList = dictDataService.selectDictDataList(twoMainSysDictData);
        LinkedHashMap<String, Long> twoMainSysDictDataOneListMap = twoMainSysDictDataOneList.stream().sorted((a, b) -> {
                    Long aDictSort = a.getDictSort();
                    Long bDictSort = b.getDictSort();
                    return aDictSort.compareTo(bDictSort);
                }) // 按值倒序排序
                .collect(Collectors.toMap(a -> a.getDictLabel(), b -> b.getDictSort(), (oldVal, newVal) -> oldVal, LinkedHashMap::new));
        for (int i = 0; i < sevenStockMainBoardFilterList.size(); i++) {
            StockMainBoard stockMainBoard = sevenStockMainBoardFilterList.get(i);
            String stockCode = stockMainBoard.getStockCode();
            if (stockCode.equals("603726")) {
                System.out.println("");
            }
            String secondDragonDetailOne = stockMainBoard.getSecondDragonDetailOne();
            String secondDragonDetailTwo = stockMainBoard.getSecondDragonDetailTwo();
            String secondDragonDetailThree = stockMainBoard.getSecondDragonDetailThree();
            String dragonDetailOne = stockMainBoard.getDragonDetailOne();
            String dragonDetailTwo = stockMainBoard.getDragonDetailTwo();
            String dragonDetailThree = stockMainBoard.getDragonDetailThree();
            for (Map.Entry<String, Long> oneEntry : twoMainSysDictDataOneListMap.entrySet()) {
                String key = oneEntry.getKey();
                String substringKey = key.substring(0, key.indexOf("("));
                Long sortId = oneEntry.getValue();
                boolean a = StringUtils.isEmpty(secondDragonDetailOne) ? false : secondDragonDetailOne.contains(substringKey);
                boolean b = StringUtils.isEmpty(secondDragonDetailTwo) ? false : secondDragonDetailTwo.contains(substringKey);
                boolean c = StringUtils.isEmpty(secondDragonDetailThree) ? false : secondDragonDetailThree.contains(substringKey);
                boolean d = StringUtils.isEmpty(dragonDetailOne) ? false : dragonDetailOne.contains(substringKey);
                boolean e = StringUtils.isEmpty(dragonDetailTwo) ? false : dragonDetailTwo.contains(substringKey);
                boolean f = StringUtils.isEmpty(dragonDetailThree) ? false : dragonDetailThree.contains(substringKey);

                if (sortId == 1L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsOne("1");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (sortId == 2L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsTwo("2");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (sortId == 3L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsThree("3");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (sortId == 4L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsFour("4");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (sortId == 5L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsFive("5");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (sortId == 6L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsSix("6");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (sortId == 7L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsSeven("7");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (sortId == 8L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsEight("8");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (sortId == 9L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsNine("9");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                } else if (sortId == 10L && (a || b || c || d || e || f)) {
                    stockMainBoard.setDragonTopicsTen("10");
                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                }
            }
        }

        //设置主板实际流通值分类
        //查询主板
        StockMainBoard fiveSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> fiveStockMainBoardList = stockMainBoardService.selectStockMainBoardList(fiveSelectStockMainBoard);
        //主板流通市值是4亿到360亿
        List<StockMainBoard> fiveStockMainBoardFilterList = fiveStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).filter(a -> a.getStockType().equals("1")).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(4)) >= 0 && a.getActualCirculationValue().compareTo(new BigDecimal(360)) <= 0).collect(Collectors.toList());
        for (StockMainBoard stockMainBoard : fiveStockMainBoardFilterList) {
            String stockCode = stockMainBoard.getStockCode();
            if (stockCode.equals("605303")) {
                System.out.println();
            }
            BigDecimal actualCirculationValue = stockMainBoard.getActualCirculationValue();
            if (actualCirculationValue.compareTo(new BigDecimal(4)) >= 0 && actualCirculationValue.compareTo(new BigDecimal(55)) < 0) {
                stockMainBoard.setActualCirculationAllStatus("0");
                stockMainBoard.setActualCirculationTypeStatus("1");
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
            } else if (actualCirculationValue.compareTo(new BigDecimal(55)) >= 0 && actualCirculationValue.compareTo(new BigDecimal(150)) < 0) {
                stockMainBoard.setActualCirculationAllStatus("0");
                stockMainBoard.setActualCirculationTypeStatus("2");
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
            } else if (actualCirculationValue.compareTo(new BigDecimal(150)) >= 0 && actualCirculationValue.compareTo(new BigDecimal(350)) < 0) {
                stockMainBoard.setActualCirculationAllStatus("0");
                stockMainBoard.setActualCirculationTypeStatus("3");
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
            }
        }

        //设置创业板实际流通市值分类
        //创业板流通市值是4亿到360亿
        List<StockMainBoard> eightStockMainBoardFilterList = fiveStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).filter(a -> a.getStockType().equals("2")).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(4)) >= 0 && a.getActualCirculationValue().compareTo(new BigDecimal(360)) <= 0).collect(Collectors.toList());
        for (StockMainBoard stockMainBoard : eightStockMainBoardFilterList) {
            String stockCode = stockMainBoard.getStockCode();
            if (stockCode.equals("002657")) {
                System.out.println();
            }
            BigDecimal actualCirculationValue = stockMainBoard.getActualCirculationValue();
            if (actualCirculationValue.compareTo(new BigDecimal(4)) >= 0 && actualCirculationValue.compareTo(new BigDecimal(55)) < 0) {
                stockMainBoard.setActualCirculationAllStatus("0");
                stockMainBoard.setActualCirculationTypeStatus("1");
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
            } else if (actualCirculationValue.compareTo(new BigDecimal(55)) >= 0 && actualCirculationValue.compareTo(new BigDecimal(150)) < 0) {
                stockMainBoard.setActualCirculationAllStatus("0");
                stockMainBoard.setActualCirculationTypeStatus("2");
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
            } else if (actualCirculationValue.compareTo(new BigDecimal(150)) >= 0 && actualCirculationValue.compareTo(new BigDecimal(350)) < 0) {
                stockMainBoard.setActualCirculationAllStatus("0");
                stockMainBoard.setActualCirculationTypeStatus("3");
                stockMainBoardService.updateStockMainBoard(stockMainBoard);
            }
        }

        //删除动态题材
        SysDictData mainSysDictData = new SysDictData();
        mainSysDictData.setDictType("dynamic_topics_status");
        List<SysDictData> mainSysDictDataOneList = dictDataService.selectDictDataList(mainSysDictData);
        String idsString = mainSysDictDataOneList.stream().map(a -> a.getDictCode()).map(String::valueOf).collect(Collectors.joining(","));
        dictDataService.deleteDictDataByIds(idsString);


        //删除动态惊喜题材
        SysDictData surpriseSysDictData = new SysDictData();
        surpriseSysDictData.setDictType("dynamic_topics_surprise_status");
        List<SysDictData> surpriseSysDictDataList = dictDataService.selectDictDataList(surpriseSysDictData);
        String twoIdsString = surpriseSysDictDataList.stream().map(a -> a.getDictCode()).map(String::valueOf).collect(Collectors.joining(","));
        dictDataService.deleteDictDataByIds(twoIdsString);

        //删除动态彩蛋题材
        SysDictData eggSysDictData = new SysDictData();
        eggSysDictData.setDictType("dynamic_topics_egg_status");
        List<SysDictData> eggSysDictDataList = dictDataService.selectDictDataList(eggSysDictData);
        String tthreeIdsString = eggSysDictDataList.stream().map(a -> a.getDictCode()).map(String::valueOf).collect(Collectors.joining(","));
        dictDataService.deleteDictDataByIds(tthreeIdsString);

        //动态题材：主板、创业板
        //查询主板
        StockMainBoard fourSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> fourStockMainBoardList = stockMainBoardService.selectStockMainBoardList(fourSelectStockMainBoard);
        List<StockMainBoard> fourStockMainBoardFilterList = fourStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).collect(Collectors.toList());
        //股票实体类
        Map<String, StockMainBoard> fourStockMainBoardListMap = fourStockMainBoardFilterList.stream().collect(Collectors.toMap(a -> {
            String stockName = a.getStockName();
            String modified = stockName.replaceAll(" ", "").trim();
            return modified;
        }, entity -> entity));
        //不参与的板块
        String[] stringArray = {"浙江", "江苏省", "上海", "重庆市", "高股息", "破净股概念", "高股息精选", "举牌", "一季报增长", "业绩增长", "超跌", "专精特新", "杭州", "福建", "VPN", "地方国企", "贬值受益", "四川省", "成都市", "年报增长", "国有企业", "并购重组", "股权转让", "平台经济", "一带一路", "电子商务", "汽车类", "汽车零部件", "新能源汽车", "汽车充电", "充电桩"};
        List<String> excludeList = Arrays.asList(stringArray);

        //所有板块
        HashMap<String, String> sectorMarkupSortStockHashMap = new HashMap<>();
        for (StockMainBoard stockMainBoard : fourStockMainBoardFilterList) {
            String sectorMarkupAllSortStock = stockMainBoard.getSectorMarkupAllSortStock();
            String[] onesplitString = sectorMarkupAllSortStock.split("<p><b>");
            for (String onesplit : onesplitString) {
                String[] towSplit = onesplit.split(":");
                if (StringUtils.isNotEmpty(towSplit[0])) {
                    String threeString = towSplit[0];
                    String[] threeSplitString = threeString.split("\\(");
                    if (!excludeList.contains(threeSplitString[0])) {
                        sectorMarkupSortStockHashMap.put(towSplit[0], towSplit[1]);
                    }
                }

            }

        }

        // 按提取的数字倒序排序
        Map<String, String> sortSectorMarkupSortStockHashMap = sectorMarkupSortStockHashMap.entrySet().stream().sorted((e1, e2) -> {
                    String oneKey = e1.getKey();
                    String[] oneSplitString = oneKey.split("\\(");
                    String oneString = oneSplitString[1];
                    String oneSubstring = oneString.substring(0, oneString.length() - 2);

                    String twoKey = e2.getKey();
                    String[] twoSplitString = twoKey.split("\\(");
                    String twoString = twoSplitString[1];
                    String twoSubstring = twoString.substring(0, twoString.length() - 2);

                    int num1 = Integer.parseInt(oneSubstring);
                    int num2 = Integer.parseInt(twoSubstring);
                    return Integer.compare(num2, num1);
                }).limit(60) // 取前20个
                // 收集到LinkedHashMap保持顺序
                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldVal, newVal) -> oldVal, LinkedHashMap::new));

        //查询主板股票详细
        StockMainBoardDetail twoStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> twoStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(twoStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> twoStockMainBoardDetailMap = twoStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.collectingAndThen(Collectors.toList(), s -> s.subList(s.size() - 1, s.size()))));
        //时间格式
        String twoDateFormat = "yyyy-MM-dd";
        SimpleDateFormat twoSdf = new SimpleDateFormat(twoDateFormat);
        // 按提取的数字倒序排序
        int index = 1;
        for (Map.Entry<String, String> oneEntry : sortSectorMarkupSortStockHashMap.entrySet()) {
            //板块名称多少只
            String sectorNameHowMany = oneEntry.getKey();
            String[] oneSplitString = sectorNameHowMany.split("\\(");
            //板块名称
            String sectorName = oneSplitString[0];

            String value = oneEntry.getValue();
            String[] twoSplitString = value.split("&nbsp;&nbsp;&nbsp;");
            for (int i = 0; i < twoSplitString.length; i++) {
                if (i != 0 && i != twoSplitString.length - 1) {
                    String threeString = twoSplitString[i];
                    String[] threeSplitString = threeString.split(" ");
                    String fourString = threeSplitString[0];
                    StockMainBoard stockMainBoard = fourStockMainBoardListMap.get(fourString);
                    if (stockMainBoard == null) {
                        continue;
                    }
                    String stockCode = stockMainBoard.getStockCode();
                    if (stockCode.equals("603928")) {
                        System.out.println();
                    }
                    Long mainId = stockMainBoard.getMainId();
                    List<StockMainBoardDetail> stockMainBoardDetails = twoStockMainBoardDetailMap.get(mainId);
                    StockMainBoardDetail detail = stockMainBoardDetails.get(0);
                    Date createTime = detail.getCreateTime();
                    String formatDate = twoSdf.format(createTime);

                    //动态题材一：主板、创业板
                    if (stockMainBoard != null) {
                        if (index == 1) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(1L);
                                oneSysDictData.setDictValue("1");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsOne("1");
                            stockMainBoard.setDynamicTopicsShowOne(sectorName);
                            //动态题材详细显示一：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowOne(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材二：主板、创业板
                        if (index == 2) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(2L);
                                oneSysDictData.setDictValue("2");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsTwo("2");
                            stockMainBoard.setDynamicTopicsShowTwo(sectorName);
                            //动态题材详细显示二：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowTwo(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材三：主板、创业板
                        if (index == 3) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(3L);
                                oneSysDictData.setDictValue("3");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsThree("3");
                            stockMainBoard.setDynamicTopicsShowThree(sectorName);
                            //动态题材详细显示三：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowThree(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材四：主板、创业板
                        if (index == 4) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(4L);
                                oneSysDictData.setDictValue("4");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsFour("4");
                            stockMainBoard.setDynamicTopicsShowFour(sectorName);
                            //动态题材详细显示四：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowFour(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材五：主板、创业板
                        if (index == 5) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(5L);
                                oneSysDictData.setDictValue("5");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsFive("5");
                            stockMainBoard.setDynamicTopicsShowFive(sectorName);
                            //动态题材详细显示五：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowFive(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材六：主板、创业板
                        if (index == 6) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(6L);
                                oneSysDictData.setDictValue("6");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSix("6");
                            stockMainBoard.setDynamicTopicsShowSix(sectorName);
                            //动态题材详细显示六：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSix(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材七：主板、创业板
                        if (index == 7) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(7L);
                                oneSysDictData.setDictValue("7");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSeven("7");
                            stockMainBoard.setDynamicTopicsShowSeven(sectorName);
                            //动态题材详细显示七：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSeven(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材八：主板、创业板
                        if (index == 8) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(8L);
                                oneSysDictData.setDictValue("8");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEight("8");
                            stockMainBoard.setDynamicTopicsShowEight(sectorName);
                            //动态题材详细显示八
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEight(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材九：主板、创业板
                        if (index == 9) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(9L);
                                oneSysDictData.setDictValue("9");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsNine("9");
                            stockMainBoard.setDynamicTopicsShowNine(sectorNameHowMany);
                            //动态题材详细显示九：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowNine(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 10) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(10L);
                                oneSysDictData.setDictValue("10");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsTen("10");
                            stockMainBoard.setDynamicTopicsShowTen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowTen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十一：主板、创业板
                        if (index == 11) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(11L);
                                oneSysDictData.setDictValue("11");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEleven("11");
                            stockMainBoard.setDynamicTopicsShowEleven(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEleven(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 12) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(12L);
                                oneSysDictData.setDictValue("12");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsTwelve("12");
                            stockMainBoard.setDynamicTopicsShowTwelve(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowTwelve(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 13) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(13L);
                                oneSysDictData.setDictValue("13");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsThirteen("13");
                            stockMainBoard.setDynamicTopicsShowThirteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowThirteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 14) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(14L);
                                oneSysDictData.setDictValue("14");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsFourteen("14");
                            stockMainBoard.setDynamicTopicsShowFourteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowFourteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 15) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(15L);
                                oneSysDictData.setDictValue("15");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsFifteen("15");
                            stockMainBoard.setDynamicTopicsShowFifteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowFifteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 16) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(16L);
                                oneSysDictData.setDictValue("16");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSixteen("16");
                            stockMainBoard.setDynamicTopicsShowSixteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSixteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 17) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(17L);
                                oneSysDictData.setDictValue("17");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSeventeen("17");
                            stockMainBoard.setDynamicTopicsShowSeventeen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSeventeen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 18) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(18L);
                                oneSysDictData.setDictValue("18");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEighteen("18");
                            stockMainBoard.setDynamicTopicsShowEighteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEighteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 19) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(19L);
                                oneSysDictData.setDictValue("19");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsNineteen("19");
                            stockMainBoard.setDynamicTopicsShowNineteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowNineteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 20) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(20L);
                                oneSysDictData.setDictValue("20");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsTwenty("20");
                            stockMainBoard.setDynamicTopicsShowTwenty(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowTwenty(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        if (index == 21) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(1L);
                                oneSysDictData.setDictValue("1");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseOne("1");
                            stockMainBoard.setDynamicTopicsShowSurpriseOne(sectorName);
                            //动态题材详细显示一：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseOne(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材二：主板、创业板
                        if (index == 22) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(2L);
                                oneSysDictData.setDictValue("2");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseTwo("2");
                            stockMainBoard.setDynamicTopicsShowSurpriseTwo(sectorName);
                            //动态题材详细显示二：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseTwo(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材三：主板、创业板
                        if (index == 23) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(3L);
                                oneSysDictData.setDictValue("3");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseThree("3");
                            stockMainBoard.setDynamicTopicsShowSurpriseThree(sectorName);
                            //动态题材详细显示三：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseThree(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材四：主板、创业板
                        if (index == 24) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(4L);
                                oneSysDictData.setDictValue("4");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseFour("4");
                            stockMainBoard.setDynamicTopicsShowSurpriseFour(sectorName);
                            //动态题材详细显示四：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseFour(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材五：主板、创业板
                        if (index == 25) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(5L);
                                oneSysDictData.setDictValue("5");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseFive("5");
                            stockMainBoard.setDynamicTopicsShowSurpriseFive(sectorName);
                            //动态题材详细显示五：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseFive(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材六：主板、创业板
                        if (index == 26) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(6L);
                                oneSysDictData.setDictValue("6");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseSix("6");
                            stockMainBoard.setDynamicTopicsShowSurpriseSix(sectorName);
                            //动态题材详细显示六：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseSix(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材七：主板、创业板
                        if (index == 27) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(7L);
                                oneSysDictData.setDictValue("7");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseSeven("7");
                            stockMainBoard.setDynamicTopicsShowSurpriseSeven(sectorName);
                            //动态题材详细显示七：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseSeven(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材八：主板、创业板
                        if (index == 28) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(8L);
                                oneSysDictData.setDictValue("8");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseEight("8");
                            stockMainBoard.setDynamicTopicsShowSurpriseEight(sectorName);
                            //动态题材详细显示八
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseEight(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材九：主板、创业板
                        if (index == 29) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(9L);
                                oneSysDictData.setDictValue("9");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseNine("9");
                            stockMainBoard.setDynamicTopicsShowSurpriseNine(sectorNameHowMany);
                            //动态题材详细显示九：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseNine(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 30) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(10L);
                                oneSysDictData.setDictValue("10");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseTen("10");
                            stockMainBoard.setDynamicTopicsShowSurpriseTen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseTen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十一：主板、创业板
                        if (index == 31) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(11L);
                                oneSysDictData.setDictValue("11");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseEleven("11");
                            stockMainBoard.setDynamicTopicsShowSurpriseEleven(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseEleven(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 32) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(12L);
                                oneSysDictData.setDictValue("12");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseTwelve("12");
                            stockMainBoard.setDynamicTopicsShowSurpriseTwelve(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseTwelve(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 33) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(13L);
                                oneSysDictData.setDictValue("13");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseThirteen("13");
                            stockMainBoard.setDynamicTopicsShowSurpriseThirteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseThirteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 34) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(14L);
                                oneSysDictData.setDictValue("14");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseFourteen("14");
                            stockMainBoard.setDynamicTopicsShowSurpriseFourteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseFourteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 35) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(15L);
                                oneSysDictData.setDictValue("15");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseFifteen("15");
                            stockMainBoard.setDynamicTopicsShowSurpriseFifteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseFifteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 36) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(16L);
                                oneSysDictData.setDictValue("16");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseSixteen("16");
                            stockMainBoard.setDynamicTopicsShowSurpriseSixteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseSixteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 37) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(17L);
                                oneSysDictData.setDictValue("17");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseSeventeen("17");
                            stockMainBoard.setDynamicTopicsShowSurpriseSeventeen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseSeventeen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 38) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(18L);
                                oneSysDictData.setDictValue("18");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseEighteen("18");
                            stockMainBoard.setDynamicTopicsShowSurpriseEighteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseEighteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 39) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(19L);
                                oneSysDictData.setDictValue("19");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseNineteen("19");
                            stockMainBoard.setDynamicTopicsShowSurpriseNineteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseNineteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 40) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_surprise_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(20L);
                                oneSysDictData.setDictValue("20");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsSurpriseTwenty("20");
                            stockMainBoard.setDynamicTopicsShowSurpriseTwenty(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowSurpriseTwenty(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态彩蛋题材十：主板、创业板
                        if (index == 41) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(1L);
                                oneSysDictData.setDictValue("1");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggOne("1");
                            stockMainBoard.setDynamicTopicsShowEggOne(sectorName);
                            //动态题材详细显示一：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggOne(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材二：主板、创业板
                        if (index == 42) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(2L);
                                oneSysDictData.setDictValue("2");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggTwo("2");
                            stockMainBoard.setDynamicTopicsShowEggTwo(sectorName);
                            //动态题材详细显示二：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggTwo(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材三：主板、创业板
                        if (index == 43) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(3L);
                                oneSysDictData.setDictValue("3");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggThree("3");
                            stockMainBoard.setDynamicTopicsShowEggThree(sectorName);
                            //动态题材详细显示三：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggThree(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材四：主板、创业板
                        if (index == 44) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(4L);
                                oneSysDictData.setDictValue("4");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggFour("4");
                            stockMainBoard.setDynamicTopicsShowEggFour(sectorName);
                            //动态题材详细显示四：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggFour(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材五：主板、创业板
                        if (index == 45) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(5L);
                                oneSysDictData.setDictValue("5");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggFive("5");
                            stockMainBoard.setDynamicTopicsShowEggFive(sectorName);
                            //动态题材详细显示五：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggFive(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材六：主板、创业板
                        if (index == 46) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(6L);
                                oneSysDictData.setDictValue("6");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggSix("6");
                            stockMainBoard.setDynamicTopicsShowEggSix(sectorName);
                            //动态题材详细显示六：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggSix(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材七：主板、创业板
                        if (index == 47) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(7L);
                                oneSysDictData.setDictValue("7");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggSeven("7");
                            stockMainBoard.setDynamicTopicsShowEggSeven(sectorName);
                            //动态题材详细显示七：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggSeven(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材八：主板、创业板
                        if (index == 48) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(8L);
                                oneSysDictData.setDictValue("8");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggEight("8");
                            stockMainBoard.setDynamicTopicsShowEggEight(sectorName);
                            //动态题材详细显示八
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggEight(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材九：主板、创业板
                        if (index == 49) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(9L);
                                oneSysDictData.setDictValue("9");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggNine("9");
                            stockMainBoard.setDynamicTopicsShowEggNine(sectorNameHowMany);
                            //动态题材详细显示九：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggNine(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 50) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(10L);
                                oneSysDictData.setDictValue("10");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggTen("10");
                            stockMainBoard.setDynamicTopicsShowEggTen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggTen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十一：主板、创业板
                        if (index == 51) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(11L);
                                oneSysDictData.setDictValue("11");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggEleven("11");
                            stockMainBoard.setDynamicTopicsShowEggEleven(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggEleven(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 52) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(12L);
                                oneSysDictData.setDictValue("12");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggTwelve("12");
                            stockMainBoard.setDynamicTopicsShowEggTwelve(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggTwelve(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 53) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(13L);
                                oneSysDictData.setDictValue("13");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggThirteen("13");
                            stockMainBoard.setDynamicTopicsShowEggThirteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggThirteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 54) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(14L);
                                oneSysDictData.setDictValue("14");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggFourteen("14");
                            stockMainBoard.setDynamicTopicsShowEggFourteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggFourteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 55) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(15L);
                                oneSysDictData.setDictValue("15");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggFifteen("15");
                            stockMainBoard.setDynamicTopicsShowEggFifteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggFifteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 56) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(16L);
                                oneSysDictData.setDictValue("16");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggSixteen("16");
                            stockMainBoard.setDynamicTopicsShowEggSixteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggSixteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 57) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(17L);
                                oneSysDictData.setDictValue("17");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggSeventeen("17");
                            stockMainBoard.setDynamicTopicsShowEggSeventeen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggSeventeen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }


                        //动态题材十：主板、创业板
                        if (index == 58) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(18L);
                                oneSysDictData.setDictValue("18");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggEighteen("18");
                            stockMainBoard.setDynamicTopicsShowEggEighteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggEighteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 59) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(19L);
                                oneSysDictData.setDictValue("19");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggNineteen("19");
                            stockMainBoard.setDynamicTopicsShowEggNineteen(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggNineteen(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                        //动态题材十：主板、创业板
                        if (index == 60) {
                            SysDictData oneSysDictData = new SysDictData();
                            oneSysDictData.setDictType("dynamic_topics_egg_status");
                            oneSysDictData.setDictLabel(sectorNameHowMany);
                            List<SysDictData> oneSysDictDataOneList = dictDataService.selectDictDataList(oneSysDictData);
                            if (oneSysDictDataOneList.size() == 0) {
                                oneSysDictData.setDictSort(20L);
                                oneSysDictData.setDictValue("20");
                                dictDataService.insertDictData(oneSysDictData);
                            }
                            stockMainBoard.setDynamicTopicsEggTwenty("20");
                            stockMainBoard.setDynamicTopicsShowEggTwenty(sectorName);
                            //动态题材详细显示十：主板、创业板
                            String dynamicTopicsDetailShowAll = stockMainBoard.getDynamicTopicsDetailShowAll();
                            if (dynamicTopicsDetailShowAll.contains(sectorName)) {
                                String fiveString = sectorName + ": ";
                                int oneIndex = dynamicTopicsDetailShowAll.indexOf(fiveString);
                                String sixString = dynamicTopicsDetailShowAll.substring(oneIndex);
                                int twoIndex = sixString.indexOf("; ");
                                String sevenString = sixString.substring(0, twoIndex);
                                int threeIndex = sevenString.indexOf(": ") + 2;
                                String eightString = sevenString.substring(threeIndex);
                                int fourIndex = eightString.indexOf(" ");
                                String nineString = eightString.substring(0, fourIndex);
                                if (nineString.equals(formatDate)) {
                                    String tenString = eightString.replaceAll(nineString, "");
                                    stockMainBoard.setDynamicTopicsDetailShowEggTwenty(sectorName + ": " + tenString);
                                }
                            }
                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
                        }

                    }
                }
            }
            index++;
        }


    }


    /**
     * 第六步：设置开盘啦数据三
     *
     * @throws IOException
     */
    public void batchKaiPanLaDataThree() throws IOException {
        //设置炽热
        //查询主板
        StockMainBoard tenSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> tenStockMainBoardList = stockMainBoardService.selectStockMainBoardList(tenSelectStockMainBoard);
        Map<Long, List<StockMainBoard>> groupStockMainBoardList = tenStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).collect(Collectors.groupingBy(StockMainBoard::getMainId));
        //查询主板股票详细
        StockMainBoardDetail tenStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> tenStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(tenStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> tenStockMainBoardDetailMap = tenStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.toList()));

        tenStockMainBoardDetailMap.entrySet().stream().forEach(tenStockMainBoardDetailMapEntry -> {
            Long mainId = tenStockMainBoardDetailMapEntry.getKey();
            if (mainId.equals(2216L)) {
                System.out.println();
            }

            int packageIndex = 1;
            List<StockMainBoardDetail> tenStockMainBoardDetails = tenStockMainBoardDetailMapEntry.getValue();
            // 1. 遍历所有交易日，识别涨停对
            BigDecimal oneLimitUp = tenStockMainBoardDetails.get(tenStockMainBoardDetails.size() - 1).getLimitUp();
            if (oneLimitUp.compareTo(new BigDecimal(9.50)) >= 0) {
                // 2. 寻找前一个涨停（跳过连续涨停）
                if (tenStockMainBoardDetails.size() > 1) {
                    BigDecimal twoLimitUp = tenStockMainBoardDetails.get(tenStockMainBoardDetails.size() - 2).getLimitUp();
                    if (twoLimitUp.compareTo(new BigDecimal(9.50)) < 0) {
                        int oneStartIndex = -1;
                        int oneEndIndex = -1;
                        for (int j = tenStockMainBoardDetails.size() - 2; j >= 0; j--) {
                            StockMainBoardDetail prev = tenStockMainBoardDetails.get(j);
                            if (prev.getLimitUp().compareTo(new BigDecimal(9.50)) >= 0) {
                                oneStartIndex = j;
                                if (oneEndIndex == -1 && oneStartIndex != -1) {
                                    int twoStartindex = oneStartIndex + 1;
                                    int twoEndIndex = tenStockMainBoardDetails.size() - 2;
                                    // 3. 调整天数(是否<= 7天)
                                    int adjustDays = (twoEndIndex - twoStartindex) + 1;
                                    if (adjustDays > 7) {
                                        break;
                                    }
                                    //4. 最小值
                                    List<StockMainBoardDetail> stockMainBoardDetails = tenStockMainBoardDetails.subList(oneStartIndex, twoEndIndex + 1);
                                    BigDecimal middleBigDecimal = new BigDecimal(0);
                                    try {
                                        middleBigDecimal = stockMainBoardDetails.stream().filter(Objects::nonNull) // 排除 null
                                                .map(a -> (BigDecimal) a.getLastPx()) // 类型转换
                                                .min(Comparator.naturalOrder()).get();
                                    } catch (Exception e) {
                                        System.out.println();
                                    }
                                    //判断是否是往上涨的调整，那么取最大值
                                    if (stockMainBoardDetails.get(0).getLastPx().compareTo(middleBigDecimal) == 0) {
                                        middleBigDecimal = stockMainBoardDetails.stream().filter(Objects::nonNull) // 排除 null
                                                .map(a -> (BigDecimal) a.getLastPx()) // 类型转换
                                                .max(Comparator.naturalOrder()).get();
                                    }
                                    //5. 前一个涨停的值与最小值之间的幅度
                                    StockMainBoardDetail oneDetail = tenStockMainBoardDetails.get(oneStartIndex);
                                    BigDecimal oneDetailLastPx = oneDetail.getLastPx();
                                    BigDecimal differ = middleBigDecimal.subtract(oneDetailLastPx).divide(oneDetailLastPx, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
                                    // 5. 保存数据
                                    if (differ.compareTo(new BigDecimal(-25)) >= 0 && differ.compareTo(new BigDecimal(0)) <= 0) {
                                        List<StockMainBoard> stockMainBoards = groupStockMainBoardList.get(mainId);
                                        if (stockMainBoards != null && stockMainBoards.size() > 0) {
                                            StockMainBoard stockMainBoard = stockMainBoards.get(0);
                                            stockMainBoard.setFervorTime(tenStockMainBoardDetails.get(tenStockMainBoardDetails.size() - 1).getCreateTime());
                                            String detail = "【 " + differ + " %, " + adjustDays + "d 】";
                                            // 6. 1包
                                            if (packageIndex == 1) {
                                                stockMainBoard.setFervorDetail("N1" + adjustDays + detail);
                                                stockMainBoardService.updateStockMainBoard(stockMainBoard);
                                                // 7. 开始的索引等于结束的索引、包索引+1
                                                oneEndIndex = oneStartIndex;
                                                packageIndex++;
                                            }
                                        }
                                    } else if (differ.compareTo(new BigDecimal(0)) > 0 && differ.compareTo(new BigDecimal(21)) <= 0) {
                                        List<StockMainBoard> stockMainBoards = groupStockMainBoardList.get(mainId);
                                        if (stockMainBoards != null && stockMainBoards.size() > 0) {
                                            StockMainBoard stockMainBoard = stockMainBoards.get(0);
                                            stockMainBoard.setFervorTime(tenStockMainBoardDetails.get(tenStockMainBoardDetails.size() - 1).getCreateTime());
                                            String detail = "【 " + differ + " %, " + adjustDays + "d 】";
                                            // 6. 1包
                                            if (packageIndex == 1) {
                                                if (adjustDays >= 1 && adjustDays <= 7) {
                                                    stockMainBoard.setFervorDetail("Z1" + adjustDays + detail);
                                                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                                                    // 7. 开始的索引等于结束的索引、包索引+1
                                                    oneEndIndex = oneStartIndex;
                                                    packageIndex++;
                                                }
                                            }
                                        }
                                    }
                                } else {

                                    // 3. 判断是否连续涨停，则跳过
                                    int twoEndIndex = oneEndIndex;
                                    BigDecimal onelimitUp = tenStockMainBoardDetails.get(oneEndIndex - 1).getLimitUp();
                                    BigDecimal twolimitUp = tenStockMainBoardDetails.get(oneEndIndex).getLimitUp();
                                    if (onelimitUp.compareTo(new BigDecimal(9.50)) >= 0 && twolimitUp.compareTo(new BigDecimal(9.50)) >= 0) {
                                        oneEndIndex = oneStartIndex;
                                        continue;
                                    }
                                    //4. 调整天数
                                    int adjustDays = (twoEndIndex - oneStartIndex) + 1;
                                    //5. 最小值
                                    List<StockMainBoardDetail> stockMainBoardDetails = tenStockMainBoardDetails.subList(oneStartIndex, twoEndIndex + 1);
                                    BigDecimal middleBigDecimal = new BigDecimal(0);
                                    try {
                                        middleBigDecimal = stockMainBoardDetails.stream().filter(Objects::nonNull) // 排除 null
                                                .map(a -> (BigDecimal) a.getLastPx()) // 类型转换
                                                .min(Comparator.naturalOrder()).get();
                                    } catch (Exception e) {
                                        System.out.println();
                                    }
                                    //判断是否是往上涨的调整，那么取最大值
                                    if (stockMainBoardDetails.get(0).getLastPx().compareTo(middleBigDecimal) == 0) {
                                        middleBigDecimal = stockMainBoardDetails.stream().filter(Objects::nonNull) // 排除 null
                                                .map(a -> (BigDecimal) a.getLastPx()) // 类型转换
                                                .max(Comparator.naturalOrder()).get();
                                    }
                                    //6. 前一个涨停的值与最小值之间的幅度

                                    // 7. 保存数据
                                    List<StockMainBoard> stockMainBoards = groupStockMainBoardList.get(mainId);
                                    if (stockMainBoards != null && stockMainBoards.size() > 0) {
                                        StockMainBoard stockMainBoard = stockMainBoards.get(0);
                                        stockMainBoard.setFervorTime(tenStockMainBoardDetails.get(tenStockMainBoardDetails.size() - 1).getCreateTime());
                                        String fervorDetail = stockMainBoard.getFervorDetail();
                                        int index = fervorDetail.indexOf("【 ");
                                        String fervorDetailSubstring = fervorDetail.substring(index);
                                        //调整天数
                                        int startIndexDay = fervorDetailSubstring.indexOf("d 】") - 1;
                                        int endIndexDay = fervorDetailSubstring.indexOf("d 】");
                                        String daysString = fervorDetailSubstring.substring(startIndexDay, endIndexDay).trim();
                                        int innerAdjustDays = Integer.parseInt(daysString);
                                        int startIndex = fervorDetailSubstring.indexOf("【 ") + 1;
                                        int endIndex = fervorDetailSubstring.indexOf(" %");
                                        String substring = fervorDetailSubstring.substring(startIndex, endIndex).trim();
                                        BigDecimal differ = new BigDecimal(substring);
                                        //3包以上排除
                                        if (packageIndex > 3) {
                                            stockMainBoard.setFervorTime(null);
                                            stockMainBoard.setFervorDetail(null);
                                            stockMainBoardCustomService.updateStockMainBoard(stockMainBoard);
                                            break;
                                        }
                                        if (differ.compareTo(new BigDecimal(-25)) >= 0 && differ.compareTo(new BigDecimal(0)) <= 0) {
                                            // 8. 1包
                                            if (packageIndex == 1) {
                                                stockMainBoard.setFervorDetail("N1" + innerAdjustDays + fervorDetailSubstring);
                                                stockMainBoardService.updateStockMainBoard(stockMainBoard);
                                                // 7. 开始的索引等于结束的索引、包索引+1
                                                oneEndIndex = oneStartIndex;
                                                packageIndex++;
                                            } else if (packageIndex == 2) {
                                                stockMainBoard.setFervorDetail("E2" + innerAdjustDays + fervorDetailSubstring);
                                                stockMainBoardService.updateStockMainBoard(stockMainBoard);
                                                // 开始的索引等于结束的索引、包索引+1
                                                oneEndIndex = oneStartIndex;
                                                packageIndex++;
                                            } else if (packageIndex == 3) {
                                                // 8. 3包
                                                stockMainBoard.setFervorDetail("Y3" + innerAdjustDays + fervorDetailSubstring);
                                                stockMainBoardService.updateStockMainBoard(stockMainBoard);
                                                //开始的索引等于结束的索引、包索引+1
                                                oneEndIndex = oneStartIndex;
                                                packageIndex++;
                                            }
                                        } else if (differ.compareTo(new BigDecimal(0)) > 0 && differ.compareTo(new BigDecimal(21)) <= 0) {
                                            // 6. 1包
                                            if (packageIndex == 1) {
                                                if (innerAdjustDays >= 1 && innerAdjustDays <= 4) {
                                                    stockMainBoard.setFervorDetail("Z1" + innerAdjustDays + fervorDetailSubstring);
                                                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                                                    // 7. 开始的索引等于结束的索引、包索引+1
                                                    oneEndIndex = oneStartIndex;
                                                    packageIndex++;
                                                }
                                            } else if (packageIndex == 2) {
                                                // 8. 2包
                                                if (innerAdjustDays >= 1 && innerAdjustDays <= 4) {
                                                    stockMainBoard.setFervorDetail("Z2" + innerAdjustDays + fervorDetailSubstring);
                                                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                                                    // 开始的索引等于结束的索引、包索引+1
                                                    oneEndIndex = oneStartIndex;
                                                    packageIndex++;
                                                }
                                            } else if (packageIndex == 3) {
                                                // 8. 3包
                                                if (innerAdjustDays >= 1 && innerAdjustDays <= 4) {
                                                    stockMainBoard.setFervorDetail("Z3" + innerAdjustDays + fervorDetailSubstring);
                                                    stockMainBoardService.updateStockMainBoard(stockMainBoard);
                                                    // 开始的索引等于结束的索引、包索引+1
                                                    oneEndIndex = oneStartIndex;
                                                    packageIndex++;
                                                }
                                            }
                                        }
                                    }

                                }
                            }
                        }
                    }
                }
            }
        });

        //动态题材：主板、创业板
        //查询主板
        StockMainBoard oneSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> oneStockMainBoardList = stockMainBoardService.selectStockMainBoardList(oneSelectStockMainBoard);
        Map<Long, List<StockMainBoard>> oneGroupStockMainBoardList = oneStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).collect(Collectors.groupingBy(StockMainBoard::getMainId));


        //查询主板股票详细
        StockMainBoardDetail oneStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> oneStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(oneStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> oneStockMainBoardDetailMap = oneStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId));


        for (Map.Entry<Long, List<StockMainBoardDetail>> tenStockMainBoardDetailMapEntry : oneStockMainBoardDetailMap.entrySet()) {
            Long mainId = tenStockMainBoardDetailMapEntry.getKey();
            if (mainId.equals(1300L)) {
                System.out.println();
            }

            List<StockMainBoardDetail> twoStockMainBoardDetails = tenStockMainBoardDetailMapEntry.getValue();
            if (twoStockMainBoardDetails.size() < 2) continue;

            // 1. 遍历所有交易日，识别涨停对
            for (int i = 0; i < twoStockMainBoardDetails.size(); i++) {
                StockMainBoardDetail curr = twoStockMainBoardDetails.get(i);
                if (curr.getLimitUp().compareTo(new BigDecimal(9.50)) < 0) continue;

                // 2. 寻找前一个涨停（跳过连续涨停）
                int prevIndex = -1;
                for (int j = twoStockMainBoardDetails.size() - 2; j >= 0; j--) {
                    StockMainBoardDetail prev = twoStockMainBoardDetails.get(j);
                    if (prev.getLimitUp().compareTo(new BigDecimal(9.50)) >= 0) {
                        prevIndex = j;
                        break;
                    }
                }
                if (prevIndex == -1) continue; // 无前序涨停则跳过

                // 3. 计算两涨停间的交易日数
                int gapDays = i - prevIndex - 1;
                if (gapDays <= 0) continue; // 连续涨停跳过

                // 4. 初始化结果对象
                StockMainBoardDetail prevLimitDetail = twoStockMainBoardDetails.get(prevIndex);
                StockMainBoardDetail todayLimitDetail = twoStockMainBoardDetails.get(i);

                // 5. 计算不同窗口期的累计涨幅（1~7天）
                BigDecimal cumulative = new BigDecimal(0);
                int indexStart = prevIndex + 1;
                int indexEnd = twoStockMainBoardDetails.size() - 2;
                for (int period = indexStart; period <= indexEnd; period++) {
                    cumulative = cumulative.add(twoStockMainBoardDetails.get(period).getLimitUp());
                }

                // 6. 最小值
                List<StockMainBoardDetail> stockMainBoardDetails = twoStockMainBoardDetails.subList(prevIndex + 1, i);
                BigDecimal middleBigDecimal = new BigDecimal(0);
                try {
                    middleBigDecimal = stockMainBoardDetails.stream().filter(Objects::nonNull) // 排除 null
                            .map(a -> (BigDecimal) a.getLastPx()) // 类型转换
                            .min(Comparator.naturalOrder()).get();
                } catch (Exception e) {
                    System.out.println();
                }
                //判断是否是往上涨的调整，那么取最大值
                if (stockMainBoardDetails.get(0).getLastPx().compareTo(middleBigDecimal) == 0) {
                    middleBigDecimal = stockMainBoardDetails.stream().filter(Objects::nonNull) // 排除 null
                            .map(a -> (BigDecimal) a.getLastPx()) // 类型转换
                            .max(Comparator.naturalOrder()).get();
                }

                // 7. 前一个涨停的值与最小值之间的幅度
                StockMainBoardDetail oneDetail = twoStockMainBoardDetails.get(prevIndex);
                BigDecimal oneDetailLastPx = oneDetail.getLastPx();
                BigDecimal oneIncrease = middleBigDecimal.subtract(oneDetailLastPx).divide(oneDetailLastPx, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));

                // 8. 涨停与涨停之间的幅度
                BigDecimal prevLimitDetailLastPx = prevLimitDetail.getLastPx();
                BigDecimal todayLimitDetailLastPx = todayLimitDetail.getLastPx();
                BigDecimal twoIncrease = todayLimitDetailLastPx.subtract(prevLimitDetailLastPx).divide(prevLimitDetailLastPx, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));

                // 9. 判断是否满足条件
                List<StockMainBoard> stockMainBoards = oneGroupStockMainBoardList.get(mainId);
//                if (stockMainBoards != null && stockMainBoards.size() > 0) {
//                    StockMainBoard stockMainBoard = stockMainBoards.get(0);
//                    int differ = indexEnd - indexStart + 1;
//                    //时间要在8-15天之间
//                    //25 【 -11.00 %, 15d N形 -1.00 % 】
//                    if (differ >= 8 && differ <= 15) {
//                        if (oneIncrease.compareTo(new BigDecimal(-13)) >= 0 && oneIncrease.compareTo(new BigDecimal(0)) <= 0) {
//                            if (twoIncrease.compareTo(new BigDecimal(-3)) >= 0 && twoIncrease.compareTo(new BigDecimal(5)) <= 0) {
//                                String detail = "【 " + oneIncrease + " %, " + differ + "d, " + twoIncrease + " % 】";
//                                //N形顶你
//                                stockMainBoard.setTopBoardTime(todayLimitDetail.getCreateTime());
//                                stockMainBoard.setTopBoardDetail("N" + differ + detail);
//                                stockMainBoardService.updateStockMainBoard(stockMainBoard);
//                            } else if (twoIncrease.compareTo(new BigDecimal(6)) >= 0 && twoIncrease.compareTo(new BigDecimal(12)) <= 0) {
//                                String detail = "【 " + oneIncrease + " %, " + differ + "d, " + twoIncrease + " % 】";
//                                //Z形顶你
//                                stockMainBoard.setTopBoardTime(todayLimitDetail.getCreateTime());
//                                stockMainBoard.setTopBoardDetail("Z" + differ + detail);
//                                stockMainBoardService.updateStockMainBoard(stockMainBoard);
//                            }
//                        } else if (oneIncrease.compareTo(new BigDecimal(0)) > 0 && oneIncrease.compareTo(new BigDecimal(24)) <= 0) {
//                            String detail = "【 " + oneIncrease + " %, " + differ + "d, " + twoIncrease + " % 】";
//                            //H形顶你
//                            stockMainBoard.setTopBoardTime(todayLimitDetail.getCreateTime());
//                            stockMainBoard.setTopBoardDetail("H " + differ + detail);
//                            stockMainBoardService.updateStockMainBoard(stockMainBoard);
//                        }
//
//                    }
//                }

                if (prevLimitDetail != null && todayLimitDetail != null) {
                    break;
                }
            }
        }

        //动态题材：主板、创业板
        //查询主板
        StockMainBoard twoSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> twoStockMainBoardList = stockMainBoardService.selectStockMainBoardList(twoSelectStockMainBoard);
        Map<Long, List<StockMainBoard>> twoGroupStockMainBoardListMap = twoStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).collect(Collectors.groupingBy(StockMainBoard::getMainId));

        //查询主板股票详细
        StockMainBoardDetail twoStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> twoStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(twoStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> twoStockMainBoardDetailMap = twoStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId));

        //龙虎榜请求时间
        String oneUrl = "https://applhb.longhuvip.com/w1/api/index.php";
        String oneJson = "st=500&a=GetStockList&c=LongHuBang&PhoneOSNew=1&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e&VerSion=5.17.0.2&Token=0&Time=&Index=0&apiv=w38&Type=2&UserID=0&";
        // 设置请求头
        HashMap<String, String> oneHeaders = new HashMap<>();
        oneHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        oneHeaders.put("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 9; NX627J Build/PQ3B.190801.01161429)");
        oneHeaders.put("Host", "applhb.longhuvip.com");
        oneHeaders.put("Connection", "Keep-Alive");
        oneHeaders.put("Accept-Encoding", "gzip");

        String oneContent = HttpClientUtil.doPost(oneUrl, oneJson, oneHeaders);
        JSONObject jsonObject = JSON.parseObject(oneContent);

        //龙虎榜时间
        String kplLhbTime = jsonObject.getString("Time");

        for (Map.Entry<Long, List<StockMainBoardDetail>> twoStockMainBoardDetailMapEntry : twoStockMainBoardDetailMap.entrySet()) {
            Long mainId = twoStockMainBoardDetailMapEntry.getKey();
            List<StockMainBoard> stockMainBoards = twoGroupStockMainBoardListMap.get(mainId);
            if (stockMainBoards == null) {
                continue;
            }
            StockMainBoard mainBoard = stockMainBoards.get(0);
            String stockCode = mainBoard.getStockCode();


            if (mainId.equals(2140L)) {
                System.out.println();
            }

            List<StockMainBoardDetail> twoStockMainBoardDetails = twoStockMainBoardDetailMapEntry.getValue();
            StockMainBoardDetail oneDetail = twoStockMainBoardDetails.get(twoStockMainBoardDetails.size() - 1);
            BigDecimal oneLimitUp = oneDetail.getLimitUp();
            BigDecimal limitUpStandard = new BigDecimal(9.50);

            //所有的龙虎榜数据
            if (oneLimitUp.compareTo(limitUpStandard) > 0) {
                String threeUrl = "https://applhb.longhuvip.com/w1/api/index.php?apiv=w41&PhoneOSNew=1&VerSion=5.20.0.6";
                String threeJson = "c=Stock&a=GetNewOneStockInfo&Type=0&Time=" + kplLhbTime + "&StockID=" + stockCode + "&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e";
                // 设置请求头
                HashMap<String, String> threeHeaders = new HashMap<>();
                threeHeaders.put("Host", "applhb.longhuvip.com");
                threeHeaders.put("Connection", "keep-alive");
                threeHeaders.put("Accept", "application/json, text/javascript, */*; q=0.01");
                threeHeaders.put("User-Agent", "Mozilla/5.0 (Linux; Android 9; NX627J Build/PQ3B.190801.01161429; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36;kaipanla 5.20.0.6");
                threeHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
                threeHeaders.put("Origin", "https://apppage.longhuvip.com");
                threeHeaders.put("X-Requested-With", "com.aiyu.kaipanla");
                threeHeaders.put("Sec-Fetch-Site", "same-site");
                threeHeaders.put("Sec-Fetch-Mode", "cors");
                threeHeaders.put("Sec-Fetch-Dest", "empty");
                threeHeaders.put("Referer", "https://apppage.longhuvip.com/");
                threeHeaders.put("Accept-Encoding", "gzip, deflate");
                threeHeaders.put("Accept-Language", "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7");

                String threeContent = HttpClientUtil.doPost(threeUrl, threeJson, threeHeaders);
                JSONObject threeJsonObject = JSON.parseObject(threeContent);

                //龙虎榜集合
                JSONArray threeList = threeJsonObject.getJSONArray("List");
                if (threeList != null) {
                    for (int i = 0; i < threeList.size(); i++) {
                        JSONObject oneJsonObject = threeList.getJSONObject(i);
                        JSONArray buyList = oneJsonObject.getJSONArray("BuyList");
                        String totalName = "";
                        for (int j = 0; j < buyList.size(); j++) {
                            JSONObject twoJSONObject = buyList.getJSONObject(j);
                            //昵称
                            JSONArray groupIconList = twoJSONObject.getJSONArray("GroupIcon");
                            String groupIcon = "";
                            for (int k = 0; k < groupIconList.size(); k++) {
                                if (k == groupIconList.size() - 1) {
                                    groupIcon += groupIconList.getString(k);
                                } else {
                                    groupIcon += groupIconList.getString(k) + ",";
                                }
                            }
                            String endGroupIcon = groupIcon.length() > 1 ? "(" + groupIcon + ")" : groupIcon;
                            //名称
                            String name = twoJSONObject.getString("Name");
                            //买入金额
                            String BuyString = twoJSONObject.getString("Buy");
                            BigDecimal buyBigDecimal = new BigDecimal(BuyString).divide(new BigDecimal(100000000), 2, BigDecimal.ROUND_HALF_UP);
                            String buy = "【" + buyBigDecimal + " 亿" + "】";

                            //总的名字加金额
                            totalName += name + endGroupIcon + buy + "+";

                        }

                        //龙虎榜
                        if (StringUtils.isNotEmpty(totalName)) {
                            //龙虎榜
                            mainBoard.setSeat(totalName);
                            stockMainBoardService.updateStockMainBoard(mainBoard);
                        }
                    }
                }
            }


            //中断
            if (twoStockMainBoardDetails.size() == 1) continue;
            //涨停的股票才请求龙虎榜数据
            if (oneLimitUp.compareTo(limitUpStandard) >= 0) {
                if (twoStockMainBoardDetails.size() == 2) {
                    StockMainBoardDetail twoDetail = twoStockMainBoardDetails.get(twoStockMainBoardDetails.size() - 2);
                    BigDecimal twoLimitUp = twoDetail.getLimitUp();
                    //中断
                    if (twoLimitUp.compareTo(limitUpStandard) < 0) {
                        continue;
                    }
                } else {
                    StockMainBoardDetail twoDetail = twoStockMainBoardDetails.get(twoStockMainBoardDetails.size() - 2);
                    BigDecimal twoLimitUp = twoDetail.getLimitUp();

                    StockMainBoardDetail threeDetail = twoStockMainBoardDetails.get(twoStockMainBoardDetails.size() - 3);
                    BigDecimal threeLimitUp = threeDetail.getLimitUp();
                    //中断
                    if (twoLimitUp.compareTo(limitUpStandard) < 0) {
                        continue;
                    } else if (twoLimitUp.compareTo(limitUpStandard) >= 0 && threeLimitUp.compareTo(limitUpStandard) >= 0) {
                        continue;
                    }
                }


                //龙虎榜数据
                String twoUrl = "https://applhb.longhuvip.com/w1/api/index.php?apiv=w41&PhoneOSNew=1&VerSion=5.20.0.6";
                String twoJson = "c=Stock&a=GetNewOneStockInfo&Type=0&Time=" + kplLhbTime + "&StockID=" + stockCode + "&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e";
                // 设置请求头
                HashMap<String, String> twoHeaders = new HashMap<>();
                twoHeaders.put("Host", "applhb.longhuvip.com");
                twoHeaders.put("Connection", "keep-alive");
                twoHeaders.put("Accept", "application/json, text/javascript, */*; q=0.01");
                twoHeaders.put("User-Agent", "Mozilla/5.0 (Linux; Android 9; NX627J Build/PQ3B.190801.01161429; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36;kaipanla 5.20.0.6");
                twoHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
                twoHeaders.put("Origin", "https://apppage.longhuvip.com");
                twoHeaders.put("X-Requested-With", "com.aiyu.kaipanla");
                twoHeaders.put("Sec-Fetch-Site", "same-site");
                twoHeaders.put("Sec-Fetch-Mode", "cors");
                twoHeaders.put("Sec-Fetch-Dest", "empty");
                twoHeaders.put("Referer", "https://apppage.longhuvip.com/");
                twoHeaders.put("Accept-Encoding", "gzip, deflate");
                twoHeaders.put("Accept-Language", "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7");

                String twoContent = HttpClientUtil.doPost(twoUrl, twoJson, twoHeaders);
                JSONObject twoJsonObject = JSON.parseObject(twoContent);
                JSONArray oneList = twoJsonObject.getJSONArray("List");
                //两连板的龙虎榜
                if (oneList == null) {
                    //没有上龙虎榜的
                    if (twoStockMainBoardDetails.size() == 2) {
                        mainBoard.setSupportBoardDetail("WD1" + " T");
                        //龙虎榜
                        mainBoard.setSeat("");
                        stockMainBoardService.updateStockMainBoard(mainBoard);

                    } else if (twoStockMainBoardDetails.size() > 2) {
                        // 1. 寻找前一个涨停（跳过连续涨停）
                        int prevIndex = -1;
                        int limitCount = 0;
                        for (int j = twoStockMainBoardDetails.size() - 3; j >= 0; j--) {
                            StockMainBoardDetail prev = twoStockMainBoardDetails.get(j);
                            if (prev.getLimitUp().compareTo(new BigDecimal(9.50)) >= 0) {
                                prevIndex = j;
                                limitCount++;
                                break;
                            }
                        }

                        if (prevIndex == -1) continue; // 无前序涨停则跳过

                        // 2. 最小值
                        List<StockMainBoardDetail> threeStockMainBoardDetails = twoStockMainBoardDetails.subList(prevIndex + 1, twoStockMainBoardDetails.size() - 1);

                        BigDecimal minBigDecimal = new BigDecimal(0);
                        try {
                            minBigDecimal = threeStockMainBoardDetails.stream().filter(Objects::nonNull) // 排除 null
                                    .map(a -> (BigDecimal) a.getLastPx()) // 类型转换
                                    .min(Comparator.naturalOrder()).get();
                        } catch (Exception e) {
                            System.out.println();
                        }

                        // 3. 前一个涨停后的值与最小值之间的幅度
                        StockMainBoardDetail threeDetail = null;
                        try {
                            threeDetail = twoStockMainBoardDetails.get(prevIndex);
                        } catch (Exception e) {
                            System.out.println();
                        }

                        BigDecimal oneDetailLastPx = threeDetail.getLastPx();
                        BigDecimal oneIncrease = minBigDecimal.subtract(oneDetailLastPx).divide(oneDetailLastPx, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));

                        // 4. 涨停与涨停之间的幅度、初始化结果对象
                        StockMainBoardDetail prevLimitDetail = twoStockMainBoardDetails.get(prevIndex);
                        StockMainBoardDetail todayLimitDetail = twoStockMainBoardDetails.get(twoStockMainBoardDetails.size() - 1);
                        BigDecimal prevLimitDetailLastPx = prevLimitDetail.getLastPx();
                        BigDecimal todayLimitDetailLastPx = todayLimitDetail.getLastPx();
                        BigDecimal twoIncrease = todayLimitDetailLastPx.subtract(prevLimitDetailLastPx).divide(prevLimitDetailLastPx, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));

                        // 5. 计算不同窗口期的累计涨幅（1~7天）
                        BigDecimal cumulative = new BigDecimal(0);
                        int indexStart = prevIndex + 1;
                        int indexEnd = twoStockMainBoardDetails.size() - 2;
                        for (int period = indexStart; period <= indexEnd; period++) {
                            cumulative = cumulative.add(twoStockMainBoardDetails.get(period).getLimitUp());
                        }

                        if (limitCount >= 1) {
                            //赞你
                            int differ = indexEnd - indexStart + 1;
                            String result = "【 " + oneIncrease + " %, " + differ + "d, " + twoIncrease + " % 】";
                            if (oneIncrease.compareTo(new BigDecimal(-25)) >= 0 && oneIncrease.compareTo(new BigDecimal(0)) <= 0) {
                                mainBoard.setSupportBoardDetail("VD1" + result);
                                //龙虎榜
                                mainBoard.setSeat("");
                                stockMainBoardService.updateStockMainBoard(mainBoard);
                            }
                        }
                    }
                    continue;
                }
                for (int i = 0; i < oneList.size(); i++) {
                    JSONObject oneJsonObject = oneList.getJSONObject(i);
                    JSONArray buyList = oneJsonObject.getJSONArray("BuyList");
                    String totalName = "";
                    for (int j = 0; j < buyList.size(); j++) {
                        JSONObject twoJSONObject = buyList.getJSONObject(j);
                        //昵称
                        JSONArray groupIconList = twoJSONObject.getJSONArray("GroupIcon");
                        String groupIcon = "";
                        for (int k = 0; k < groupIconList.size(); k++) {
                            if (k == groupIconList.size() - 1) {
                                groupIcon += groupIconList.getString(k);
                            } else {
                                groupIcon += groupIconList.getString(k) + ",";
                            }
                        }
                        String endGroupIcon = groupIcon.length() > 1 ? "(" + groupIcon + ")" : groupIcon;
                        //名称
                        String name = twoJSONObject.getString("Name");
                        //买入金额
                        String BuyString = twoJSONObject.getString("Buy");
                        BigDecimal buyBigDecimal = new BigDecimal(BuyString).divide(new BigDecimal(100000000), 2, BigDecimal.ROUND_HALF_UP);
                        String buy = "【" + buyBigDecimal + " 亿" + "】";

                        //总的名字
                        totalName += name + endGroupIcon + buy + "+";

                    }

                    //龙虎榜
                    if (StringUtils.isNotEmpty(totalName)) {
                        //龙虎榜
                        mainBoard.setSeat(totalName);
                        stockMainBoardService.updateStockMainBoard(mainBoard);
                    }

                    //设置龙虎榜
                    if (twoStockMainBoardDetails.size() == 2) {
                        //赞你
                        char lookFor = '量';
                        long numOfOccurrences = totalName.chars().filter(c -> c == lookFor).count();
                        if ((totalName.contains("深股通") && numOfOccurrences == 1) || (totalName.contains("沪股通") && numOfOccurrences == 1)) {
                            mainBoard.setSupportBoardDetail("WF1" + " T");
                            //龙虎榜
                            mainBoard.setSeat(totalName);
                            stockMainBoardService.updateStockMainBoard(mainBoard);
                        } else if (totalName.contains("深股通") || totalName.contains("沪股通") || numOfOccurrences == 1) {
                            mainBoard.setSupportBoardDetail("WF2" + " T");
                            //龙虎榜
                            mainBoard.setSeat(totalName);
                            stockMainBoardService.updateStockMainBoard(mainBoard);
                        } else if (numOfOccurrences == 2) {
                            mainBoard.setSupportBoardDetail("WD2" + " T");
                            //龙虎榜
                            mainBoard.setSeat(totalName);
                            stockMainBoardService.updateStockMainBoard(mainBoard);
                        } else if (numOfOccurrences == 3) {
                            mainBoard.setSupportBoardDetail("WD3" + " T");
                            //龙虎榜
                            mainBoard.setSeat(totalName);
                            stockMainBoardService.updateStockMainBoard(mainBoard);
                        } else if (numOfOccurrences == 4) {
                            mainBoard.setSupportBoardDetail("WD4" + " T");
                            //龙虎榜
                            mainBoard.setSeat(totalName);
                            stockMainBoardService.updateStockMainBoard(mainBoard);
                        } else if (numOfOccurrences == 5) {
                            mainBoard.setSupportBoardDetail("WD5" + " T");
                            //龙虎榜
                            mainBoard.setSeat(totalName);
                            stockMainBoardService.updateStockMainBoard(mainBoard);
                        } else if (StringUtils.isNotEmpty(totalName)) {
                            mainBoard.setSupportBoardDetail("WF3" + " T");
                            //龙虎榜
                            mainBoard.setSeat(totalName);
                            stockMainBoardService.updateStockMainBoard(mainBoard);
                        } else {
                            mainBoard.setSupportBoardDetail("WD1" + " T");
                            //龙虎榜
                            mainBoard.setSeat(totalName);
                            stockMainBoardService.updateStockMainBoard(mainBoard);
                        }

                    } else if (twoStockMainBoardDetails.size() <= 7) {

                        // 1. 寻找前一个涨停（跳过连续涨停）
                        int prevIndex = -1;
                        int limitCount = 0;
                        for (int j = twoStockMainBoardDetails.size() - 3; j >= 0; j--) {
                            StockMainBoardDetail prev = twoStockMainBoardDetails.get(j);
                            if (prev.getLimitUp().compareTo(new BigDecimal(9.50)) >= 0) {
                                prevIndex = j;
                                limitCount++;
                                break;
                            }
                        }

                        if (prevIndex == -1) continue; // 无前序涨停则跳过

                        // 2. 最小值
                        List<StockMainBoardDetail> threeStockMainBoardDetails = twoStockMainBoardDetails.subList(prevIndex + 1, twoStockMainBoardDetails.size() - 1);

                        BigDecimal minBigDecimal = new BigDecimal(0);
                        try {
                            minBigDecimal = threeStockMainBoardDetails.stream().filter(Objects::nonNull) // 排除 null
                                    .map(a -> (BigDecimal) a.getLastPx()) // 类型转换
                                    .min(Comparator.naturalOrder()).get();
                        } catch (Exception e) {
                            System.out.println();
                        }

                        // 3. 前一个涨停后的值与最小值之间的幅度
                        StockMainBoardDetail threeDetail = null;
                        try {
                            threeDetail = twoStockMainBoardDetails.get(prevIndex);
                        } catch (Exception e) {
                            System.out.println();
                        }

                        BigDecimal oneDetailLastPx = threeDetail.getLastPx();
                        BigDecimal oneIncrease = minBigDecimal.subtract(oneDetailLastPx).divide(oneDetailLastPx, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));

                        // 4. 涨停与涨停之间的幅度、初始化结果对象
                        StockMainBoardDetail prevLimitDetail = twoStockMainBoardDetails.get(prevIndex);
                        StockMainBoardDetail todayLimitDetail = twoStockMainBoardDetails.get(twoStockMainBoardDetails.size() - 1);
                        BigDecimal prevLimitDetailLastPx = prevLimitDetail.getLastPx();
                        BigDecimal todayLimitDetailLastPx = todayLimitDetail.getLastPx();
                        BigDecimal twoIncrease = todayLimitDetailLastPx.subtract(prevLimitDetailLastPx).divide(prevLimitDetailLastPx, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));

                        // 5. 计算不同窗口期的累计涨幅（1~7天）
                        BigDecimal cumulative = new BigDecimal(0);
                        int indexStart = prevIndex + 1;
                        int indexEnd = twoStockMainBoardDetails.size() - 2;
                        for (int period = indexStart; period <= indexEnd; period++) {
                            cumulative = cumulative.add(twoStockMainBoardDetails.get(period).getLimitUp());
                        }

                        if (limitCount >= 1) {
                            //赞你
                            int differ = indexEnd - indexStart + 1;
                            String result = "【 " + oneIncrease + " %, " + differ + "d, " + twoIncrease + " % 】";
                            if (oneIncrease.compareTo(new BigDecimal(-25)) >= 0 && oneIncrease.compareTo(new BigDecimal(0)) <= 7) {
                                char lookFor = '量';
                                long numOfOccurrences = totalName.chars().filter(c -> c == lookFor).count();
                                if ((totalName.contains("深股通") && numOfOccurrences == 1) || (totalName.contains("沪股通") && numOfOccurrences == 1)) {
                                    mainBoard.setSupportBoardDetail("VF1" + result);
                                    //龙虎榜
                                    mainBoard.setSeat(totalName);
                                    stockMainBoardService.updateStockMainBoard(mainBoard);
                                } else if (totalName.contains("深股通") || totalName.contains("沪股通") || numOfOccurrences == 1) {
                                    mainBoard.setSupportBoardDetail("VF2" + result);
                                    //龙虎榜
                                    mainBoard.setSeat(totalName);
                                    stockMainBoardService.updateStockMainBoard(mainBoard);
                                } else if (numOfOccurrences == 2) {
                                    mainBoard.setSupportBoardDetail("VD2" + result);
                                    //龙虎榜
                                    mainBoard.setSeat(totalName);
                                    stockMainBoardService.updateStockMainBoard(mainBoard);
                                } else if (numOfOccurrences == 3) {
                                    mainBoard.setSupportBoardDetail("VD3" + result);
                                    //龙虎榜
                                    mainBoard.setSeat(totalName);
                                    stockMainBoardService.updateStockMainBoard(mainBoard);
                                } else if (numOfOccurrences == 4) {
                                    mainBoard.setSupportBoardDetail("WD4" + " T");
                                    //龙虎榜
                                    mainBoard.setSeat(totalName);
                                    stockMainBoardService.updateStockMainBoard(mainBoard);
                                } else if (numOfOccurrences == 5) {
                                    mainBoard.setSupportBoardDetail("WD5" + " T");
                                    //龙虎榜
                                    mainBoard.setSeat(totalName);
                                    stockMainBoardService.updateStockMainBoard(mainBoard);
                                } else if (StringUtils.isNotEmpty(totalName)) {
                                    mainBoard.setSupportBoardDetail("VF3" + result);
                                    //龙虎榜
                                    mainBoard.setSeat(totalName);
                                    stockMainBoardService.updateStockMainBoard(mainBoard);
                                } else {
                                    mainBoard.setSupportBoardDetail("VD1" + result);
                                    //龙虎榜
                                    mainBoard.setSeat(totalName);
                                    stockMainBoardService.updateStockMainBoard(mainBoard);
                                }
                            }
                        }
                    }
                }
            }

        }

    }

    /**
     * 第六步：设置开盘啦数据四
     *
     * @throws IOException
     */
    public void batchKaiPanLaDataFour() throws IOException {
        //发送邮件
        //查询主板
        StockMainBoard twoSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> twoStockMainBoardList = stockMainBoardService.selectStockMainBoardList(twoSelectStockMainBoard);
        List<StockMainBoard> collectStockMainBoardList = twoStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).filter(a -> a.getDynamicTopicsDetailShowAll() != null).collect(Collectors.toList());

        String addString = new String();
        for (int i = 0; i < collectStockMainBoardList.size(); i++) {
            StockMainBoard mainBoard = collectStockMainBoardList.get(i);
            String dynamicTopicsDetailShowAll = mainBoard.getDynamicTopicsDetailShowAll();
            if (StringUtils.isNotEmpty(dynamicTopicsDetailShowAll)) {
                String[] split = dynamicTopicsDetailShowAll.split("; ");
                for (int j = 0; j < split.length; j++) {
                    String s = split[j];
                    if (s.length() > 30) {
                        if (!addString.contains(s)) {
                            addString += s + "\n\n";
                        }
                    }

                }
            }
        }
        Date date = new Date();
        //开盘啦概念创建时间
        String dateFormat = "yyyy-MM-dd";
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        // 将字符串解析为日期对象
        String formatString = null;
        formatString = sdf.format(date);
        //第一封邮件
        mailService.sendText("644258812@qq.com", formatString + " 新闻概要", addString);

        //查询主板股票
        StockMainBoard fourSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> fourStockMainBoardList = stockMainBoardService.selectStockMainBoardList(fourSelectStockMainBoard);
        Map<String, StockMainBoard> fourcodeToMainIdMap = fourStockMainBoardList.stream().collect(Collectors.toMap(StockMainBoard::getStockCode, a -> a));


        List<String> seatCodeList = new ArrayList<>();
        seatCodeList.add("10664");//中信证券上海分公司
        seatCodeList.add("20855");//国泰海通证券总部
        seatCodeList.add("12159");//华鑫证券上海分公司
        seatCodeList.add("20821");//华鑫证券上海云锦路
        seatCodeList.add("13065");//东亚前海证券浙江分公司
        seatCodeList.add("16543");//东亚前海证券四川分公司
        seatCodeList.add("6014");//中国国际金融上海分公司
        seatCodeList.add("20525");//东亚前海证券苏州分公司
        seatCodeList.add("8484");//东方证券厦门仙岳路
        seatCodeList.add("9045");//中信证券浙江分公司
        seatCodeList.add("163");//中信证券杭州凤起路
        // 模拟多个JSON数据
        List<String> jsonDataList = new ArrayList<>();
        for (int i = 0; i < seatCodeList.size(); i++) {
            String seatCode = seatCodeList.get(i);
            //设置中信证券上海分公司
            String oneUrl = "https://applhb.longhuvip.com/w1/api/index.php";
            String oneJson = "c=Business&BusinessID=" + seatCode + "&Time=12&st=30&a=GetNewDoStockLog&Index=0&SDay=0&Day=3&Money=5000000&Order=2&UserID=1863392&Token=a0b33af2b0c636487eba081b75fcb004&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e";
            // 设置请求头
            HashMap<String, String> oneHeaders = new HashMap<>();
            oneHeaders.put("Host", "applhb.longhuvip.com");
            oneHeaders.put("Connection", "keep-alive");
            oneHeaders.put("Accept", "application/json, text/javascript, */*; q=0.01");
            oneHeaders.put("User-Agent", "Mozilla/5.0 (Linux; Android 9; NX627J Build/PQ3B.190801.01161429; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36;kaipanla 5.21.0.0");
            oneHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            oneHeaders.put("Origin", "https://apppage.longhuvip.com");
            oneHeaders.put("X-Requested-With", "com.aiyu.kaipanla");
            oneHeaders.put("Sec-Fetch-Site", "same-site");
            oneHeaders.put("Sec-Fetch-Mode", "cors");
            oneHeaders.put("Sec-Fetch-Dest", "empty");
            oneHeaders.put("Referer", "https://apppage.longhuvip.com/");
            oneHeaders.put("Accept-Encoding", "gzip, deflate");
            oneHeaders.put("Accept-Language", "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7");

            String oneContent = HttpClientUtil.doPost(oneUrl, oneJson, oneHeaders);
            jsonDataList.add(oneContent);
        }


        //席位
        HashMap<String, String> seatHashMap = new HashMap<>();
        seatHashMap.put("10664", "中信证券上海分公司");
        seatHashMap.put("20855", "国泰海通证券总部");
        seatHashMap.put("12159", "华鑫证券上海分公司");
        seatHashMap.put("20821", "华鑫证券上海云锦路");
        seatHashMap.put("13065", "东亚前海证券浙江分公司");
        seatHashMap.put("16543", "东亚前海证券四川分公司");
        seatHashMap.put("6014", "中国国际金融上海分公司");
        seatHashMap.put("20525", "东亚前海证券苏州分公司");
        seatHashMap.put("8484", "东方证券厦门仙岳路");
        seatHashMap.put("9045", "中信证券浙江分公司");
        seatHashMap.put("163", "中信证券杭州凤起路");

        Map<String, List<StockTransactionSto>> transactionsByBid = new LinkedHashMap<>();
        //股票代码集合
        HashSet<String> stockCodeList = new HashSet<>();
        //交易日期：
        DateTimeFormatter ccformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        Optional<LocalDate> maxDate = jsonDataList.stream().filter(a -> {
            JSONObject jsonObject = JSON.parseObject(a);
            String Day = jsonObject.getString("Day");
            return StringUtils.isNotBlank(Day);
        }).map(jsonData -> {
            JSONObject jsonObject = JSON.parseObject(jsonData);
            String Day = jsonObject.getString("Day");
            return LocalDate.parse(Day, ccformatter);
        }).max(LocalDate::compareTo);
        String tradeDate = new String();
        if (maxDate.isPresent()) {
            tradeDate = maxDate.get().format(ccformatter);
        }

        for (String jsonData : jsonDataList) {
            JSONObject jsonObject = JSON.parseObject(jsonData);
            JSONArray list = jsonObject.getJSONArray("list");
            //
            String Day = jsonObject.getString("Day");

            for (int i = 0; i < list.size(); i++) {
                JSONObject item = list.getJSONObject(i);

                String logID = item.getString("LogID");
                String StockID = item.getString("StockID");
                String percentageStr = item.getString("IncreaseAmount");
                // 1. 去除百分号
                String numberStr = percentageStr.replace("%", "");

                // 2. 将字符串转换为double数值
                double numberValue = Double.parseDouble(numberStr);

                // 3. 获取数值的绝对值
                double absoluteValue = Math.abs(numberValue);
                if (StockID.equals("002513")) {
                    System.out.println();
                }

                String Time = item.getString("Time");
                if (tradeDate.equals(Time) && absoluteValue >= 9.50) {
                    stockCodeList.add(StockID);
                }

                String stockName = item.getString("Name");
                String oneIncreaseAmountStr = item.getString("IncreaseAmount");
                int index = oneIncreaseAmountStr.indexOf("%");
                String twoIncreaseAmountStr = oneIncreaseAmountStr.substring(0, index);
                BigDecimal IncreaseAmount = new BigDecimal(twoIncreaseAmountStr);


                // 处理Buy和Sell字段，可能是数字或字符串
                double buyAmount = 0;

                Object buyObj = item.get("Buy");
                if (buyObj instanceof Number) {
                    buyAmount = ((Number) buyObj).doubleValue();
                } else if (buyObj instanceof String) {
                    try {
                        buyAmount = Double.parseDouble((String) buyObj);
                    } catch (NumberFormatException e) {
                        buyAmount = 0;
                    }
                }
                double sellAmount = 0;
                Object sellObj = item.get("Sell");
                if (sellObj instanceof Number) {
                    sellAmount = ((Number) sellObj).doubleValue();
                } else if (sellObj instanceof String) {
                    try {
                        sellAmount = Double.parseDouble((String) sellObj);
                    } catch (NumberFormatException e) {
                        sellAmount = 0;
                    }
                }

                String time = item.getString("Time");
                String bid = item.getString("BID");

                StockMainBoard mainBoard = fourcodeToMainIdMap.get(StockID);
                String concept = "";
                if (mainBoard != null) {
                    String innerconcept = mainBoard.getConcept() == null ? "" : mainBoard.getConcept();
                    concept = innerconcept.substring(0, innerconcept.length());
                }


                if ((StockID.startsWith("60") && IncreaseAmount.compareTo(new BigDecimal(9.95)) >= 0 && tradeDate.equals(Time)) || (StockID.startsWith("00") && IncreaseAmount.compareTo(new BigDecimal(9.95)) >= 0) && tradeDate.equals(Time)) {
                    StockMainBoard mainBoard1 = fourcodeToMainIdMap.get(StockID);
                    if (mainBoard1 == null) {
                        System.out.println();
                    }
                    BigDecimal actualCirculationValue = mainBoard1 == null ? new BigDecimal(0) : mainBoard1.getActualCirculationValue();
                    StockTransactionSto transaction = new StockTransactionSto(logID, StockID, stockName, actualCirculationValue, buyAmount, sellAmount, time, bid, concept);

                    // 按席位分组
                    if (!transactionsByBid.containsKey(bid)) {
                        transactionsByBid.put(bid, new ArrayList<>());
                    }
                    transactionsByBid.get(bid).add(transaction);
                }
            }
        }


        StringBuilder htmlBuilder = new StringBuilder();

        // HTML头部和CSS样式
        htmlBuilder.append("<!DOCTYPE html>").append("<html>").append("<head>").append("<meta charset=\"UTF-8\">").append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">").append("<style>").append("body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 20px; background-color: #f8f9fa; }").append(".container { max-width: 100%; margin: 0 auto; background-color: white; padding: 25px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }").append(".header { text-align: center; margin-bottom: 30px; }").append("h1 { color: #2c3e50; margin-bottom: 10px; font-size: 28px; }").append(".subtitle { color: #7f8c8d; font-size: 16px; margin-bottom: 20px; }").append(".bid-card { margin-bottom: 30px; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border: 1px solid #e9ecef; }").append(".bid-header { background: linear-gradient(135deg, #3498db, #2980b9); color: white; padding: 15px 20px; }").append(".bid-name { font-size: 18px; font-weight: 600; }").append("table { width: 100%; border-collapse: collapse; table-layout: fixed; }").append("th { background-color: #f8f9fa; color: #495057; padding: 14px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #e9ecef; }").append("td { padding: 12px; border-bottom: 1px solid #e9ecef; color: #212529; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }").append("tr:last-child td { border-bottom: none; }").append("tr:hover { background-color: #f8f9fa; }").append(".buy-amount { color: #27ae60; font-weight: 600; text-align: right; }").append(".sell-amount { color: #e74c3c; font-weight: 600; text-align: right; }").append(".stock-code { font-family: monospace; }").append(".footer { text-align: center; margin-top: 40px; color: #6c757d; font-size: 14px; padding-top: 20px; border-top: 1px solid #e9ecef; }").append("@media (max-width: 768px) {").append("  .container { padding: 15px; }").append("  th, td { padding: 8px; font-size: 14px; }").append("  h1 { font-size: 24px; }").append("}")
                //换行
                .append(".wrap-cell { word-wrap: break-word; overflow-wrap: break-word; white-space: normal; }").append("</style>").append("</head>").append("<body>").append("<div class='container'>").append("<div class='header'>").append("<h1>股票交易席位汇总表</h1>").append("<div class='subtitle'>生成时间: ").append(new Date()).append("</div>").append("</div>");

        htmlBuilder.append("<h2 style='color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 8px; margin-top: 40px;'>").append("交易日期: ").append(tradeDate).append("</h2>");

        // 合并同一股票的买入和卖出金额
        Map<String, StockTransactionSto> totalmergedTransactions = new LinkedHashMap<>();
        // 添加每个日期和席位的表格
        for (Map.Entry<String, List<StockTransactionSto>> entry : transactionsByBid.entrySet()) {
            String bid = entry.getKey();
            List<StockTransactionSto> transactions = entry.getValue();
            Map<String, StockTransactionSto> mergedTransactions = new LinkedHashMap<>();
            for (StockTransactionSto transaction : transactions) {
                String stockKey = transaction.getStockID() + "_" + transaction.getStockName();

                if (!mergedTransactions.containsKey(stockKey)) {
                    mergedTransactions.put(stockKey, new StockTransactionSto("", transaction.getStockID(), transaction.getStockName(), transaction.getActualCirculationValue(), 0, 0, transaction.getTime(), transaction.getBid(), transaction.getConcept()));
                }

                StockTransactionSto merged = mergedTransactions.get(stockKey);
                mergedTransactions.put(stockKey, new StockTransactionSto("", merged.getStockID(), merged.getStockName(), transaction.getActualCirculationValue(), merged.getBuyAmount() + transaction.getBuyAmount(), merged.getSellAmount() + transaction.getSellAmount(), merged.getTime(), merged.getBid(), merged.getConcept()));
            }

            htmlBuilder.append("<div class='bid-card'>").append("<div class='bid-header'>").append("<div class='bid-name'>席位: ").append(seatHashMap.get(bid)).append("</div>").append("</div>").append("<table>").append("<tr>").append("<th style='width: 10%;'>股票名称</th>").append("<th style='width: 10%;'>市值</th>").append("<th style='width: 10%; text-align: right;'>买入金额</th>").append("<th style='width: 10%; text-align: right;'>卖出金额</th>").append("<th style='width: 60%; text-align: right;'>概念</th>").append("</tr>");

            // 添加合并后的交易数据
            for (Map.Entry<String, StockTransactionSto> twoentry : mergedTransactions.entrySet()) {
                String key = twoentry.getKey();
                StockTransactionSto transaction = twoentry.getValue();
                if (totalmergedTransactions.get(key) == null) {
                    totalmergedTransactions.put(key, transaction);
                }
                BigDecimal actualCirculationValue = transaction.getActualCirculationValue() == null ? BigDecimal.ZERO : transaction.getActualCirculationValue();
                BigDecimal actualCirculationValueRoundingMode = actualCirculationValue.setScale(0, RoundingMode.DOWN);
                htmlBuilder.append("<tr>").append("<td class='stock-code'>").append(transaction.getStockName()).append("</td>").append("<td>").append(actualCirculationValueRoundingMode).append("</td>").append("<td class='buy-amount'>").append(DateUtil.formatMoney(transaction.getBuyAmount())).append("</td>").append("<td class='sell-amount'>").append(DateUtil.formatMoney(transaction.getSellAmount())).append("</td>").append("<td class='wrap-cell'>").append(transaction.getConcept()).append("</td>").append("</tr>");
            }

            htmlBuilder.append("</table>").append("</div>");
        }

        // HTML尾部和页脚
        htmlBuilder.append("<div class='footer'>").append("<p>© 2025 股票交易分析系统 | 本邮件由系统自动生成</p>").append("</div>").append("</div>").append("</body>").append("</html>");

        //第二封邮件
        mailService.sendHtml("644258812@qq.com", formatString + " 重要席位", htmlBuilder.toString());


        //设置连榜
        //设置国泰海通证券总部
        String threeUrl = "https://applhb.longhuvip.com/w1/api/index.php";
        String threeJson = "a=GetStockList&st=500&c=LongHuBang&PhoneOSNew=1&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e&VerSion=5.21.0.0&Token=49eeaf795a0e32bff2a31c386d556221&Time=&Index=0&apiv=w42&Type=2&UserID=1863392&";
        // 设置请求头
        HashMap<String, String> threeHeaders = new HashMap<>();
        threeHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        threeHeaders.put("User-Agent", "Dalvik/2.1.0 (Linux; U; Android 9; NX627J Build/PQ3B.190801.01161429)");
        threeHeaders.put("Host", "applhb.longhuvip.com");
        threeHeaders.put("Connection", "Keep-Alive");
        threeHeaders.put("Accept-Encoding", "gzip");

        String threeContent = HttpClientUtil.doPost(threeUrl, threeJson, threeHeaders);
        JSONObject threeJsonObject = JSON.parseObject(threeContent);
        JSONObject countJSONObject = threeJsonObject.getJSONObject("Count");
        Set<String> countKeysSet = countJSONObject.keySet();
        List<String> longhubangCountKeysList = countKeysSet.stream().filter(a -> {
            return a.startsWith("60") || a.startsWith("00");
        }).collect(Collectors.toList());

        //查询详细
        StockMainBoardDetail fiveStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> fiveStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(fiveStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> fiveStockMainBoardDetailMap = fiveStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId));

        StockMainBoard sixSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> sixStockMainBoardList = stockMainBoardService.selectStockMainBoardList(sixSelectStockMainBoard);
        Map<Long, StockMainBoard> sixcodeToMainIdMap = sixStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).collect(Collectors.toMap(StockMainBoard::getMainId, a -> a));

        Map<Long, List<StockMainBoardDetail>> sevenStockMainBoardDetailMap = fiveStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.toList()));

        //股票代码+日期
        SimpleDateFormat detailFormatter = new SimpleDateFormat("yyyy-MM-dd");
        Map<String, StockMainBoardDetail> sixStockMainBoardDetailMap = fiveStockMainBoardDetailList.stream().filter(a -> {
            Long mainId = a.getMainId();
            if (sixcodeToMainIdMap.containsKey(mainId)) {
                return true;
            } else {
                return false;
            }
        }).collect(Collectors.toMap(detail -> {
            Long mainId = detail.getMainId();
            Date createTime = detail.getCreateTime();
            String formattedDate = detailFormatter.format(createTime);
            StockMainBoard mainBoard = sixcodeToMainIdMap.get(mainId);
            String stockCode = mainBoard.getStockCode();

            String vaule = stockCode + "/" + formattedDate;
            return vaule;

        }, a -> a));
        //两连板
        ArrayList<StockRankingSto> twoConsecutiveBoardstoList = new ArrayList<>();
        //无边榜
        ArrayList<StockRankingSto> noBaoBangPackageStockRankingStoList = new ArrayList<>();
        //左边榜
        ArrayList<StockRankingSto> leftBaoBangPackageStockRankingStoList = new ArrayList<>();
        //右续榜
        ArrayList<StockRankingSto> rightContinuousBaoBangPackageStockRankingStoList = new ArrayList<>();
        //右边榜
        ArrayList<StockRankingSto> rightBaoBangPackageStockRankingStoList = new ArrayList<>();
        //双边榜
        ArrayList<StockRankingSto> reversePackageStockRankingStoList = new ArrayList<>();
        //双续榜
        ArrayList<StockRankingSto> continuousStockRankingStoList = new ArrayList<>();
        //无际榜
        ArrayList<StockRankingSto> boundlessBoardStoList = new ArrayList<>();
        //首次板
        ArrayList<StockRankingSto> firstBoardStoList = new ArrayList<>();
        //剩余板
        ArrayList<StockRankingSto> remainBoardStoList = new ArrayList<>();


        //左边榜
        StockMainBoard leftSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> leftStockMainBoardList = stockMainBoardService.selectStockMainBoardList(leftSelectStockMainBoard);
        List<StockMainBoard> leftcollectStockMainBoardList = leftStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).filter(a -> a.getDynamicTopicsDetailShowAll() != null).filter(a -> {
            String stockCode = a.getStockCode();
            if (!longhubangCountKeysList.contains(stockCode)) {
                return true;
            } else {
                return false;
            }
        }).collect(Collectors.toList());


        for (String stockCode : longhubangCountKeysList) {

            if (stockCode.equals("000021")) {
                System.out.println();
            }
            String fourUrl = "https://applhb.longhuvip.com/w1/api/index.php?apiv=w42&PhoneOSNew=1&VerSion=5.21.0.0";
            String fourJson = "c=Stock&a=GetNewOneStockInfo&Type=0&Time=&StockID=" + stockCode + "&UserID=1863392&Token=49eeaf795a0e32bff2a31c386d556221&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e";
            // 设置请求头
            HashMap<String, String> fourHeaders = new HashMap<>();
            fourHeaders.put("Host", "applhb.longhuvip.com");
            fourHeaders.put("Connection", "keep-alive");
            fourHeaders.put("Accept", "application/json, text/javascript, */*; q=0.01");
            fourHeaders.put("User-Agent", "Mozilla/5.0 (Linux; Android 9; NX627J Build/PQ3B.190801.01161429; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36;kaipanla 5.21.0.0");
            fourHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            fourHeaders.put("Origin", "https://apppage.longhuvip.com");
            fourHeaders.put("X-Requested-With", "com.aiyu.kaipanla");
            fourHeaders.put("Sec-Fetch-Site", "same-site");
            fourHeaders.put("Sec-Fetch-Mode", "cors");
            fourHeaders.put("Sec-Fetch-Dest", "empty");
            fourHeaders.put("Referer", "https://apppage.longhuvip.com/");
            fourHeaders.put("Accept-Encoding", "gzip, deflate");
            fourHeaders.put("Accept-Language", "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7");

            String fourContent = HttpClientUtil.doPost(fourUrl, fourJson, fourHeaders);
            JSONObject fourJsonObject = JSON.parseObject(fourContent);
            JSONArray OnTimeList = fourJsonObject.getJSONArray("OnTimeList");

            // 将字符串转换为 LocalDate
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            List<LocalDate> dates = OnTimeList.stream().map(dateStr -> LocalDate.parse(dateStr.toString(), formatter)).toList();


            //双续榜
            int continuePackageCount = 1; // 至少有一个日期（第一个）
            for (int i = 1; i < dates.size(); i++) {
                LocalDate prev = dates.get(i - 1);
                LocalDate current = dates.get(i);

                LocalDate nextWorkday = current.plusDays(1);
                // 循环直到找到非周末的工作日
                while (nextWorkday.getDayOfWeek().getValue() >= DayOfWeek.SATURDAY.getValue()) {
                    nextWorkday = nextWorkday.plusDays(1);
                }
                // 如果当前日期等于下一个工作日，则视为连续
                if (prev.equals(nextWorkday)) {
                    continuePackageCount++;
                } else {
                    break; // 不连续，停止计数
                }
            }

            //反包榜
            int reversePackageCount = 0;
            LocalDate now = null;
            DateTimeFormatter twoformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            for (int i = 0; i < dates.size(); i++) {
                if (now == null) {
                    now = dates.get(i);
                    continue;
                }
                LocalDate currentDate = dates.get(i);
                long before15Workdays = DateUtil.calculateWorkdaysBetween(currentDate, now);
                if (before15Workdays <= 15) {
                    String dateString = currentDate.format(twoformatter);
                    String key = stockCode + "/" + dateString;
                    if (sixStockMainBoardDetailMap.get(key) != null) {
                        StockMainBoardDetail detail = sixStockMainBoardDetailMap.get(key);
                        BigDecimal limitUp = detail.getLimitUp();
                        if (limitUp.compareTo(new BigDecimal("9.95")) >= 0) {
                            reversePackageCount = (int) before15Workdays;
                        }
                    }
                }
            }

            //双续榜次数
            boolean isOk = true;
            boolean isContinuePackage = false;
            if (continuePackageCount == 2) {
                StockMainBoard threeMainBoard = fourcodeToMainIdMap.get(stockCode);
                if (threeMainBoard == null) {
                    continue;
                }
                String stockCode1 = threeMainBoard.getStockCode();
                if (stockCode1.equals("002295")) {
                    System.out.println();
                }
                if (threeMainBoard != null) {
                    String stockName = threeMainBoard.getStockName();
                    BigDecimal actualCirculationValue = threeMainBoard.getActualCirculationValue();
                    Long mainId = threeMainBoard.getMainId();
                    List<StockMainBoardDetail> onestockMainBoardDetails = fiveStockMainBoardDetailMap.get(mainId);
                    StockMainBoardDetail onedetail = onestockMainBoardDetails.get(onestockMainBoardDetails.size() - 1);
                    BigDecimal onelimitUp = onedetail.getLimitUp();

                    List<StockMainBoardDetail> twostockMainBoardDetails = fiveStockMainBoardDetailMap.get(mainId);
                    StockMainBoardDetail twodetail = twostockMainBoardDetails.get(onestockMainBoardDetails.size() - 2);
                    BigDecimal twolimitUp = twodetail.getLimitUp();

                    if (StringUtils.isNotEmpty(stockName) && onelimitUp.compareTo(new BigDecimal("9.50")) >= 0 && twolimitUp.compareTo(new BigDecimal("9.90")) >= 0) {
                        String concept = "";
                        if (threeMainBoard != null) {
                            String innerconcept = threeMainBoard.getConcept() == null ? "" : threeMainBoard.getConcept();
                            concept = innerconcept.substring(0, innerconcept.length());
                        }
                        StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, continuePackageCount, concept);
                        continuousStockRankingStoList.add(sto);
                        isOk = false;
                    } else {
                        isContinuePackage = true;
                    }
                }
            }

            // 双边榜次数
            if (reversePackageCount > 0 && isOk) {
                StockMainBoard twoMainBoard = fourcodeToMainIdMap.get(stockCode);
                if (twoMainBoard != null) {
                    String stockName = twoMainBoard.getStockName();
                    BigDecimal actualCirculationValue = twoMainBoard.getActualCirculationValue();
                    Long mainId = twoMainBoard.getMainId();
                    List<StockMainBoardDetail> stockMainBoardDetails = fiveStockMainBoardDetailMap.get(mainId);
                    StockMainBoardDetail detail = stockMainBoardDetails.get(0);
                    BigDecimal limitUp = detail.getLimitUp();
                    if (StringUtils.isNotEmpty(stockName) && limitUp.compareTo(new BigDecimal("9.50")) >= 0) {
                        String concept = "";
                        if (twoMainBoard != null) {
                            String innerconcept = twoMainBoard.getConcept() == null ? "" : twoMainBoard.getConcept();
                            concept = innerconcept.substring(0, innerconcept.length());
                        }
                        StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, reversePackageCount, concept);
                        reversePackageStockRankingStoList.add(sto);
                        isContinuePackage = false;
                    }
                }
            }

            //右续榜
            if (isContinuePackage) {
                StockMainBoard twoMainBoard = fourcodeToMainIdMap.get(stockCode);
                if (twoMainBoard != null) {
                    Long mainId = twoMainBoard.getMainId();
                    String stockName = twoMainBoard.getStockName();
                    BigDecimal actualCirculationValue = twoMainBoard.getActualCirculationValue();
                    List<StockMainBoardDetail> stockMainBoardDetails = sevenStockMainBoardDetailMap.get(mainId);
                    StockMainBoardDetail detail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 1);
                    BigDecimal limitUp = detail.getLimitUp();
                    if (limitUp.compareTo(new BigDecimal("9.90")) >= 0) {
                        Object[] result = DateUtil.findPreContinuousLimitUpIn15Days(stockMainBoardDetails);
                        if (result != null) {
                            String concept = "";
                            if (twoMainBoard != null) {
                                String innerconcept = twoMainBoard.getConcept() == null ? "" : twoMainBoard.getConcept();
                                concept = innerconcept.substring(0, innerconcept.length());
                            }
                            Object countObject = result[1];
                            Integer count = Integer.valueOf(countObject.toString());
                            StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, count, concept);
                            rightContinuousBaoBangPackageStockRankingStoList.add(sto);
                        }
                    }
                }
            }

            //右边榜
            if (continuePackageCount == 1 && reversePackageCount == 0) {
                StockMainBoard twoMainBoard = fourcodeToMainIdMap.get(stockCode);
                if (twoMainBoard != null) {
                    Long mainId = twoMainBoard.getMainId();
                    String stockCode1 = twoMainBoard.getStockCode();
                    if (stockCode1.equals("002513")) {
                        System.out.println();
                    }
                    String stockName = twoMainBoard.getStockName();
                    BigDecimal actualCirculationValue = twoMainBoard.getActualCirculationValue();
                    List<StockMainBoardDetail> stockMainBoardDetails = sevenStockMainBoardDetailMap.get(mainId);
                    StockMainBoardDetail detail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 1);
                    BigDecimal limitUp = detail.getLimitUp();
                    if (limitUp.compareTo(new BigDecimal("9.90")) >= 0) {
                        Object[] result = DateUtil.findPreContinuousLimitUpIn15Days(stockMainBoardDetails);
                        if (result != null) {
                            String concept = "";
                            if (twoMainBoard != null) {
                                String innerconcept = twoMainBoard.getConcept() == null ? "" : twoMainBoard.getConcept();
                                concept = innerconcept.substring(0, innerconcept.length());
                            }
                            Object countObject = result[1];
                            Integer count = Integer.valueOf(countObject.toString());
                            StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, count, concept);
                            rightBaoBangPackageStockRankingStoList.add(sto);
                        }
                    }
                }
            }
        }


        //无边榜
        ArrayList<String> filterString = new ArrayList<>();
        SimpleDateFormat threesdf = new SimpleDateFormat(dateFormat);
        for (StockMainBoard threeMainBoard : leftcollectStockMainBoardList) {
            String stockCode = threeMainBoard.getStockCode();
            String stockName = threeMainBoard.getStockName();
            BigDecimal actualCirculationValue = threeMainBoard.getActualCirculationValue();
            if (stockCode.equals("603269")) {
                System.out.println();
            }
            Long mainId1 = threeMainBoard.getMainId();
            List<StockMainBoardDetail> stockMainBoardDetails = sevenStockMainBoardDetailMap.get(mainId1);

            String fourUrl = "https://applhb.longhuvip.com/w1/api/index.php?apiv=w42&PhoneOSNew=1&VerSion=5.21.0.0";
            String fourJson = "c=Stock&a=GetNewOneStockInfo&Type=0&Time=&StockID=" + threeMainBoard.getStockCode() + "&UserID=1863392&Token=49eeaf795a0e32bff2a31c386d556221&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e";
            // 设置请求头
            HashMap<String, String> fourHeaders = new HashMap<>();
            fourHeaders.put("Host", "applhb.longhuvip.com");
            fourHeaders.put("Connection", "keep-alive");
            fourHeaders.put("Accept", "application/json, text/javascript, */*; q=0.01");
            fourHeaders.put("User-Agent", "Mozilla/5.0 (Linux; Android 9; NX627J Build/PQ3B.190801.01161429; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36;kaipanla 5.21.0.0");
            fourHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            fourHeaders.put("Origin", "https://apppage.longhuvip.com");
            fourHeaders.put("X-Requested-With", "com.aiyu.kaipanla");
            fourHeaders.put("Sec-Fetch-Site", "same-site");
            fourHeaders.put("Sec-Fetch-Mode", "cors");
            fourHeaders.put("Sec-Fetch-Dest", "empty");
            fourHeaders.put("Referer", "https://apppage.longhuvip.com/");
            fourHeaders.put("Accept-Encoding", "gzip, deflate");
            fourHeaders.put("Accept-Language", "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7");

            String fourContent = HttpClientUtil.doPost(fourUrl, fourJson, fourHeaders);
            JSONObject fourJsonObject = JSON.parseObject(fourContent);
            JSONArray OnTimeList = fourJsonObject.getJSONArray("OnTimeList");

            // 将字符串转换为 LocalDate
            List<String> dates = OnTimeList.stream().map(a -> a.toString()).toList();
            if (stockMainBoardDetails.size() == 3) {
                StockMainBoardDetail onedetail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 1);
                BigDecimal onelimitUp = onedetail.getLimitUp();
                StockMainBoardDetail twodetail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 2);
                BigDecimal twolimitUp = twodetail.getLimitUp();
                StockMainBoardDetail threedetail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 3);
                BigDecimal threelimitUp = threedetail.getLimitUp();
                //创建时间
                Date threecreateTime = threedetail.getCreateTime();
                String threecreateTimeString = threesdf.format(threecreateTime);

                if (onelimitUp.compareTo(new BigDecimal("9.90")) >= 0 && twolimitUp.compareTo(new BigDecimal("9.90")) < 0 && threelimitUp.compareTo(new BigDecimal("9.90")) >= 0 && !dates.contains(threecreateTimeString)) {
                    filterString.add(threeMainBoard.getStockCode());
                    String concept = "";
                    if (threeMainBoard != null) {
                        String innerconcept = threeMainBoard.getConcept() == null ? "" : threeMainBoard.getConcept();
                        concept = innerconcept.substring(0, innerconcept.length());
                    }
                    StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, 1, concept);
                    noBaoBangPackageStockRankingStoList.add(sto);
                }

            } else if (stockMainBoardDetails.size() > 3) {
                StockMainBoardDetail onedetail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 1);
                BigDecimal onelimitUp = onedetail.getLimitUp();
                StockMainBoardDetail twodetail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 2);
                BigDecimal twolimitUp = twodetail.getLimitUp();
                StockMainBoardDetail threedetail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 3);
                BigDecimal threelimitUp = threedetail.getLimitUp();
                StockMainBoardDetail fourdetail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 4);
                BigDecimal fourlimitUp = fourdetail.getLimitUp();
                //创建时间
                Date threecreateTime = threedetail.getCreateTime();
                String threecreateTimeString = threesdf.format(threecreateTime);
                //创建时间
                Date fourcreateTime = fourdetail.getCreateTime();
                String fourcreateTimeString = threesdf.format(fourcreateTime);
                if ((onelimitUp.compareTo(new BigDecimal("9.90")) >= 0 && twolimitUp.compareTo(new BigDecimal("9.90")) < 0 && threelimitUp.compareTo(new BigDecimal("9.90")) >= 0 && !dates.contains(threecreateTimeString)) || (onelimitUp.compareTo(new BigDecimal("9.90")) >= 0 && twolimitUp.compareTo(new BigDecimal("9.90")) < 0 && threelimitUp.compareTo(new BigDecimal("9.90")) < 0 && fourlimitUp.compareTo(new BigDecimal("9.90")) >= 0) && !dates.contains(fourcreateTimeString)) {
                    filterString.add(threeMainBoard.getStockCode());
                    String concept = "";
                    if (threeMainBoard != null) {
                        String innerconcept = threeMainBoard.getConcept() == null ? "" : threeMainBoard.getConcept();
                        concept = innerconcept.substring(0, innerconcept.length());
                    }
                    StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, 1, concept);
                    noBaoBangPackageStockRankingStoList.add(sto);
                }

            }
        }

        List<StockMainBoard> leftfilteredList = leftcollectStockMainBoardList.stream().filter(person -> !filterString.contains(person.getStockCode())) // 过滤条件：保留满足条件的元素
                .collect(Collectors.toList()); // 将过滤后的流收集到一个新的 List 中

        //左边榜
        for (StockMainBoard threeMainBoard : leftfilteredList) {
            String stockCode = threeMainBoard.getStockCode();
            if (stockCode.equals("600330")) {
                System.out.println();
            }
            String fourUrl = "https://applhb.longhuvip.com/w1/api/index.php?apiv=w42&PhoneOSNew=1&VerSion=5.21.0.0";
            String fourJson = "c=Stock&a=GetNewOneStockInfo&Type=0&Time=&StockID=" + threeMainBoard.getStockCode() + "&UserID=1863392&Token=49eeaf795a0e32bff2a31c386d556221&DeviceID=c6b240b6-aa62-371d-9f1b-45c09dff494e";
            // 设置请求头
            HashMap<String, String> fourHeaders = new HashMap<>();
            fourHeaders.put("Host", "applhb.longhuvip.com");
            fourHeaders.put("Connection", "keep-alive");
            fourHeaders.put("Accept", "application/json, text/javascript, */*; q=0.01");
            fourHeaders.put("User-Agent", "Mozilla/5.0 (Linux; Android 9; NX627J Build/PQ3B.190801.01161429; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/91.0.4472.114 Mobile Safari/537.36;kaipanla 5.21.0.0");
            fourHeaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            fourHeaders.put("Origin", "https://apppage.longhuvip.com");
            fourHeaders.put("X-Requested-With", "com.aiyu.kaipanla");
            fourHeaders.put("Sec-Fetch-Site", "same-site");
            fourHeaders.put("Sec-Fetch-Mode", "cors");
            fourHeaders.put("Sec-Fetch-Dest", "empty");
            fourHeaders.put("Referer", "https://apppage.longhuvip.com/");
            fourHeaders.put("Accept-Encoding", "gzip, deflate");
            fourHeaders.put("Accept-Language", "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7");

            String fourContent = HttpClientUtil.doPost(fourUrl, fourJson, fourHeaders);
            JSONObject fourJsonObject = JSON.parseObject(fourContent);
            JSONArray OnTimeList = fourJsonObject.getJSONArray("OnTimeList");

            // 将字符串转换为 LocalDate
            List<String> dates = OnTimeList.stream().map(a -> a.toString()).toList();

            Long mainId = threeMainBoard.getMainId();
            String stockName = threeMainBoard.getStockName();
            BigDecimal actualCirculationValue = threeMainBoard.getActualCirculationValue();
            List<StockMainBoardDetail> stockMainBoardDetails = sevenStockMainBoardDetailMap.get(mainId);
            StockMainBoardDetail detail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 1);
            BigDecimal limitUp = detail.getLimitUp();
            if (limitUp.compareTo(new BigDecimal("9.90")) >= 0) {
                System.out.println("zf" + stockName);
                Object[] result = DateUtil.processStocks(stockMainBoardDetails, dates);
                if (result != null) {
                    String concept = "";
                    if (threeMainBoard != null) {
                        String innerconcept = threeMainBoard.getConcept() == null ? "" : threeMainBoard.getConcept();
                        concept = innerconcept.substring(0, innerconcept.length());
                    }
                    Object countObject = result[1];
                    Integer count = Integer.valueOf(countObject.toString());
                    StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, count, concept);
                    leftBaoBangPackageStockRankingStoList.add(sto);
                }
            }
        }

        //连榜排序
        List<StockRankingSto> stockRankingSSorttoList = continuousStockRankingStoList.stream().sorted(Comparator.comparingInt(StockRankingSto::getFrequency)).collect(Collectors.toList());
        //涨停板
        StockMainBoard tenSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> tenStockMainBoardList = stockMainBoardService.selectStockMainBoardList(tenSelectStockMainBoard);

        List<String> totalList = new ArrayList<>();

        //无边榜
        noBaoBangPackageStockRankingStoList.stream().forEach(a -> {
            totalList.add(a.getStockID());
        });
        //左边榜
        leftBaoBangPackageStockRankingStoList.stream().forEach(a -> {
            totalList.add(a.getStockID());
        });
        //右边榜
        rightBaoBangPackageStockRankingStoList.stream().forEach(a -> {
            totalList.add(a.getStockID());
        });
        //双边榜
        reversePackageStockRankingStoList.stream().forEach(a -> {
            totalList.add(a.getStockID());
        });
        //双续榜
        stockRankingSSorttoList.stream().forEach(a -> {
            totalList.add(a.getStockID());
        });
        //两连板
        List<StockMainBoard> twelvencollectStockMainBoardList = tenStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).filter(a -> StringUtils.isNotEmpty(a.getSupportBoardDetail())).collect(Collectors.toList());
        twelvencollectStockMainBoardList.stream().filter(a -> {
            String stockCode = a.getStockCode();
            if (stockCode.equals("603026")) {
                System.out.println();
            }
            boolean isok = !totalList.contains(a.getStockCode());
            return isok;
        }).filter(a -> {
            String stockCode = a.getStockCode();
            boolean b1 = totalmergedTransactions.keySet().stream().anyMatch(b -> {
                String[] s = b.split("_");
                return s[0].equals(stockCode);
            });
            return !b1;
        }).forEach(stockMainBoard -> {
            String stockCodexx = stockMainBoard.getStockCode();
            String stockNamexx = stockMainBoard.getStockName();
            BigDecimal actualCirculationValue = stockMainBoard.getActualCirculationValue();
            if (stockCodexx.equals("002670")) {
                System.out.println("");
            }
            String concept = "";
            if (stockMainBoard != null) {
                if (stockMainBoard != null) {
                    String innerconcept = stockMainBoard.getConcept() == null ? "" : stockMainBoard.getConcept();
                    concept = innerconcept.substring(0, innerconcept.length());
                }
                StockRankingSto sto = new StockRankingSto(stockCodexx, stockNamexx, actualCirculationValue, 1, concept);
                twoConsecutiveBoardstoList.add(sto);
            }
        });

        //两连板
        twoConsecutiveBoardstoList.stream().forEach(a -> {
            totalList.add(a.getStockID());
        });

        //首次板
        List<StockMainBoard> thirteencollectStockMainBoardList = tenStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).collect(Collectors.toList());
        StockMainBoardDetail thirteenStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> thirteenStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(thirteenStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> fthirteenStockMainBoardDetailMap = thirteenStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId));

        thirteencollectStockMainBoardList.stream().filter(a -> {
            String stockCode = a.getStockCode();
            if (stockCode.equals("600895")) {
                System.out.println();
            }
            boolean isok = !totalList.contains(a.getStockCode());
            return isok;
        }).filter(a -> {
            String stockCode = a.getStockCode();
            boolean isok = !stockCodeList.contains(a.getStockCode());
            return isok;
        }).filter(a -> {
            List<StockMainBoardDetail> stockMainBoardDetails = fthirteenStockMainBoardDetailMap.get(a.getMainId());
            if (stockMainBoardDetails.size() == 1) {
                return true;
            } else {
                return false;
            }
        }).forEach(stockMainBoard -> {
            String stockCodexx = stockMainBoard.getStockCode();
            String stockNamexx = stockMainBoard.getStockName();
            BigDecimal actualCirculationValue = stockMainBoard.getActualCirculationValue();
            if (stockCodexx.equals("600895")) {
                System.out.println("");
            }
            String concept = "";
            if (stockMainBoard != null) {
                if (stockMainBoard != null) {
                    String innerconcept = stockMainBoard.getConcept() == null ? "" : stockMainBoard.getConcept();
                    concept = innerconcept.substring(0, innerconcept.length());
                }
                StockRankingSto sto = new StockRankingSto(stockCodexx, stockNamexx, actualCirculationValue, 1, concept);
                firstBoardStoList.add(sto);
            }
        });


        //无际榜
        List<StockMainBoard> fourteenCollectStockMainBoardList = tenStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).filter(a -> a.getActualCirculationValue().compareTo(new BigDecimal(0)) != 0).collect(Collectors.toList());
        StockMainBoardDetail fourteenStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> fourteenStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(fourteenStockMainBoardDetail);
        Map<Long, List<StockMainBoardDetail>> fourteenStockMainBoardDetailMap = fourteenStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId));

        //首次榜股票代码
        List<String> firstBoardStoStockIDList = firstBoardStoList.stream().map(a -> a.getStockID()).collect(Collectors.toList());
        fourteenCollectStockMainBoardList.stream().filter(a -> {
            String stockCode = a.getStockCode();
            if (stockCode.equals("600895")) {
                System.out.println();
            }
            boolean isok = !totalList.contains(a.getStockCode());
            return isok;
        }).filter(a -> {
            String stockCode = a.getStockCode();
            boolean isok = !stockCodeList.contains(stockCode);
            return isok;
        }).filter(a -> {
            String stockCode = a.getStockCode();
            boolean isok = !firstBoardStoStockIDList.contains(stockCode);
            return isok;
        }).forEach(stockMainBoard -> {
            String stockCode = stockMainBoard.getStockCode();
            if (stockCode != null) {
                Long mainId = stockMainBoard.getMainId();
                String stockName = stockMainBoard.getStockName();
                String stockCode1 = stockMainBoard.getStockCode();
                if (stockCode1.equals("002759")) {
                    System.out.println();
                }
                BigDecimal actualCirculationValue = stockMainBoard.getActualCirculationValue();
                List<StockMainBoardDetail> stockMainBoardDetails = fourteenStockMainBoardDetailMap.get(mainId);
                StockMainBoardDetail detail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 1);
                BigDecimal limitUp = detail.getLimitUp();
                if (limitUp.compareTo(new BigDecimal("9.90")) >= 0) {
                    int i = DateUtil.calculateMaxContinuousLimitUpDays(stockMainBoardDetails);
                    if (i < 2) {
                        Object[] result = DateUtil.findPreContinuousLimitUpIn15Days(stockMainBoardDetails);
                        if (result != null) {
                            String concept = "";
                            if (stockCode != null) {
                                String innerconcept = stockMainBoard.getConcept() == null ? "" : stockMainBoard.getConcept();
                                concept = innerconcept.substring(0, innerconcept.length());
                            }
                            Object countObject = result[1];
                            Integer count = Integer.valueOf(countObject.toString());
                            StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, count, concept);
                            boundlessBoardStoList.add(sto);
                        }
                    }
                }
            }
        });

        //无际榜股票代码
        List<String> boundlessBoardStoStockIDList = boundlessBoardStoList.stream().map(a -> a.getStockID()).collect(Collectors.toList());
        fourteenCollectStockMainBoardList.stream().filter(a -> {
            String stockCode = a.getStockCode();
            if (stockCode.equals("600895")) {
                System.out.println();
            }
            boolean isok = !totalList.contains(a.getStockCode());
            return isok;
        }).filter(a -> {
            String stockCode = a.getStockCode();
            boolean isok = !stockCodeList.contains(stockCode);
            return isok;
        }).filter(a -> {
            String stockCode = a.getStockCode();
            boolean isok = !firstBoardStoStockIDList.contains(stockCode);
            return isok;
        }).filter(a -> {
            String stockCode = a.getStockCode();
            boolean isok = !boundlessBoardStoStockIDList.contains(stockCode);
            return isok;
        }).forEach(stockMainBoard -> {
            String stockCode = stockMainBoard.getStockCode();
            if (stockCode.equals("002513")) {
                System.out.println();
            }
            if (stockCode != null) {
                Long mainId = stockMainBoard.getMainId();
                String stockName = stockMainBoard.getStockName();
                BigDecimal actualCirculationValue = stockMainBoard.getActualCirculationValue();
                List<StockMainBoardDetail> stockMainBoardDetails = fourteenStockMainBoardDetailMap.get(mainId);
                StockMainBoardDetail detail = stockMainBoardDetails.get(stockMainBoardDetails.size() - 1);
                BigDecimal limitUp = detail.getLimitUp();
                if (limitUp.compareTo(new BigDecimal("9.90")) >= 0) {
                    Object[] result = DateUtil.findPreContinuousLimitUpIn30Days(stockMainBoardDetails);
                    if (result != null) {
                        String concept = "";
                        if (stockCode != null) {
                            String innerconcept = stockMainBoard.getConcept() == null ? "" : stockMainBoard.getConcept();
                            concept = innerconcept.substring(0, innerconcept.length());
                        }
                        Object countObject = result[1];
                        Integer count = Integer.valueOf(countObject.toString());
                        StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, count, concept);
                        remainBoardStoList.add(sto);
                    } else {
                        int count = DateUtil.calculateMaxContinuousLimitUpDays(stockMainBoardDetails);
                        String concept = "";
                        if (stockCode != null) {
                            String innerconcept = stockMainBoard.getConcept() == null ? "" : stockMainBoard.getConcept();
                            concept = innerconcept.substring(0, innerconcept.length());
                        }
                        StockRankingSto sto = new StockRankingSto(stockCode, stockName, actualCirculationValue, count, concept);
                        remainBoardStoList.add(sto);
                    }
                }
            }
        });



        //2-7天(上海)
        ArrayList<StockRankingSto> a1 = new ArrayList<>();
        ArrayList<StockRankingSto> a2 = new ArrayList<>();
        ArrayList<StockRankingSto> a3 = new ArrayList<>();
        ArrayList<StockRankingSto> a4 = new ArrayList<>();
        ArrayList<StockRankingSto> a5 = new ArrayList<>();
        ArrayList<StockRankingSto> a6 = new ArrayList<>();
        ArrayList<StockRankingSto> a7 = new ArrayList<>();
        ArrayList<StockRankingSto> a8 = new ArrayList<>();
        ArrayList<StockRankingSto> a9 = new ArrayList<>();
        ArrayList<StockRankingSto> a10 = new ArrayList<>();

        //8-30天(上海)
        ArrayList<StockRankingSto> b1 = new ArrayList<>();
        ArrayList<StockRankingSto> b2 = new ArrayList<>();
        ArrayList<StockRankingSto> b3 = new ArrayList<>();
        ArrayList<StockRankingSto> b4 = new ArrayList<>();
        ArrayList<StockRankingSto> b5 = new ArrayList<>();
        ArrayList<StockRankingSto> b6 = new ArrayList<>();
        ArrayList<StockRankingSto> b7 = new ArrayList<>();
        ArrayList<StockRankingSto> b8 = new ArrayList<>();
        ArrayList<StockRankingSto> b9 = new ArrayList<>();
        ArrayList<StockRankingSto> b10 = new ArrayList<>();

        //
        ArrayList<StockRankingSto> c1 = new ArrayList<>();
        ArrayList<StockRankingSto> c2 = new ArrayList<>();
        ArrayList<StockRankingSto> c3 = new ArrayList<>();
        ArrayList<StockRankingSto> c4 = new ArrayList<>();
        ArrayList<StockRankingSto> c5 = new ArrayList<>();
        ArrayList<StockRankingSto> c6 = new ArrayList<>();
        ArrayList<StockRankingSto> c7 = new ArrayList<>();
        ArrayList<StockRankingSto> c8 = new ArrayList<>();
        ArrayList<StockRankingSto> c9 = new ArrayList<>();
        ArrayList<StockRankingSto> c10 = new ArrayList<>();


        //2-7天(深圳)
        ArrayList<StockRankingSto> d1 = new ArrayList<>();
        ArrayList<StockRankingSto> d2 = new ArrayList<>();
        ArrayList<StockRankingSto> d3 = new ArrayList<>();
        ArrayList<StockRankingSto> d4 = new ArrayList<>();
        ArrayList<StockRankingSto> d5 = new ArrayList<>();
        ArrayList<StockRankingSto> d6 = new ArrayList<>();
        ArrayList<StockRankingSto> d7 = new ArrayList<>();
        ArrayList<StockRankingSto> d8 = new ArrayList<>();
        ArrayList<StockRankingSto> d9 = new ArrayList<>();


        //8-30天(深圳)
        ArrayList<StockRankingSto> e1 = new ArrayList<>();
        ArrayList<StockRankingSto> e2 = new ArrayList<>();
        ArrayList<StockRankingSto> e3 = new ArrayList<>();
        ArrayList<StockRankingSto> e4 = new ArrayList<>();
        ArrayList<StockRankingSto> e5 = new ArrayList<>();
        ArrayList<StockRankingSto> e6 = new ArrayList<>();
        ArrayList<StockRankingSto> e7 = new ArrayList<>();
        ArrayList<StockRankingSto> e8 = new ArrayList<>();
        ArrayList<StockRankingSto> e9 = new ArrayList<>();


        //
        ArrayList<StockRankingSto> f1 = new ArrayList<>();
        ArrayList<StockRankingSto> f2 = new ArrayList<>();
        ArrayList<StockRankingSto> f3 = new ArrayList<>();
        ArrayList<StockRankingSto> f4 = new ArrayList<>();
        ArrayList<StockRankingSto> f5 = new ArrayList<>();
        ArrayList<StockRankingSto> f6 = new ArrayList<>();
        ArrayList<StockRankingSto> f7 = new ArrayList<>();
        ArrayList<StockRankingSto> f8 = new ArrayList<>();
        ArrayList<StockRankingSto> f9 = new ArrayList<>();
        ArrayList<StockRankingSto> f10 = new ArrayList<>();

        //首次板
        ArrayList<StockRankingSto> g1 = new ArrayList<>();
        ArrayList<StockRankingSto> g2 = new ArrayList<>();

        //查询详细


        StockMainBoard aaSelectStockMainBoard = new StockMainBoard();
        List<StockMainBoard> aaStockMainBoardList = stockMainBoardService.selectStockMainBoardList(aaSelectStockMainBoard);
        Map<String, Long> aacodeToMainIdMap = aaStockMainBoardList.stream().filter(a -> a.getActualCirculationValue() != null).collect(Collectors.toMap(StockMainBoard::getStockCode, StockMainBoard::getMainId));

        StockMainBoardDetail bbStockMainBoardDetail = new StockMainBoardDetail();
        List<StockMainBoardDetail> bbStockMainBoardDetailList = stockMainBoardDetailService.selectStockMainBoardDetailList(bbStockMainBoardDetail);
        Map<Long, Long> countByMainId = bbStockMainBoardDetailList.stream().collect(Collectors.groupingBy(StockMainBoardDetail::getMainId, Collectors.counting()));

        //两连板
        twoConsecutiveBoardstoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            Long mainId = aacodeToMainIdMap.get(stockID);
            Long size = countByMainId.get(mainId);
            if (stockID.startsWith("60")) {
                if (size >= 2 && size <= 7) {
                    a1.add(stockRankingSto);
                    stockRankingSto.setStockType("两连小");
                } else if (size >= 8 && size <= 30) {
                    b1.add(stockRankingSto);
                    stockRankingSto.setStockType("两连大");
                }
            } else if (stockID.startsWith("00")) {
                if (size >= 2 && size <= 7) {
                    d1.add(stockRankingSto);
                    stockRankingSto.setStockType("两连小");
                } else if (size >= 8 && size <= 30) {
                    e1.add(stockRankingSto);
                    stockRankingSto.setStockType("两连大");
                }
            }
        });

        //无边榜
        noBaoBangPackageStockRankingStoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            Long mainId = aacodeToMainIdMap.get(stockID);
            Long size = countByMainId.get(mainId);
            if (stockID.startsWith("60")) {
                if (size >= 2 && size <= 7) {
                    a2.add(stockRankingSto);
                    stockRankingSto.setStockType("无边小");
                } else if (size >= 8 && size <= 30) {
                    b2.add(stockRankingSto);
                    stockRankingSto.setStockType("无边大");
                }
            } else if (stockID.startsWith("00")) {
                if (size >= 2 && size <= 7) {
                    d2.add(stockRankingSto);
                    stockRankingSto.setStockType("无边小");
                } else if (size >= 8 && size <= 30) {
                    e2.add(stockRankingSto);
                    stockRankingSto.setStockType("无边大");
                }
            }
        });


        //左边榜
        leftBaoBangPackageStockRankingStoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            Long mainId = aacodeToMainIdMap.get(stockID);
            Long size = countByMainId.get(mainId);
            if (stockID.startsWith("60")) {
                if (size >= 2 && size <= 7) {
                    a3.add(stockRankingSto);
                    stockRankingSto.setStockType("左边小");
                } else if (size >= 8 && size <= 30) {
                    b3.add(stockRankingSto);
                    stockRankingSto.setStockType("左边大");
                }
            } else if (stockID.startsWith("00")) {
                if (size >= 2 && size <= 7) {
                    d3.add(stockRankingSto);
                    stockRankingSto.setStockType("左边小");
                } else if (size >= 8 && size <= 30) {
                    e3.add(stockRankingSto);
                    stockRankingSto.setStockType("左边大");
                }
            }
        });


        //右续榜
        rightContinuousBaoBangPackageStockRankingStoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            Long mainId = aacodeToMainIdMap.get(stockID);
            Long size = countByMainId.get(mainId);
            if (stockID.startsWith("60")) {
                if (size >= 2 && size <= 7) {
                    a4.add(stockRankingSto);
                    stockRankingSto.setStockType("右续小");
                } else if (size >= 8 && size <= 30) {
                    b4.add(stockRankingSto);
                    stockRankingSto.setStockType("右续大");
                }
            } else if (stockID.startsWith("00")) {
                if (size >= 2 && size <= 7) {
                    d4.add(stockRankingSto);
                    stockRankingSto.setStockType("右续小");
                } else if (size >= 8 && size <= 30) {
                    e4.add(stockRankingSto);
                    stockRankingSto.setStockType("右续大");
                }
            }
        });


        //右边板
        rightBaoBangPackageStockRankingStoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            Long mainId = aacodeToMainIdMap.get(stockID);
            Long size = countByMainId.get(mainId);
            if (stockID.startsWith("60")) {
                if (size >= 2 && size <= 7) {
                    a5.add(stockRankingSto);
                    stockRankingSto.setStockType("右边小");
                } else if (size >= 8 && size <= 30) {
                    b5.add(stockRankingSto);
                    stockRankingSto.setStockType("右边大");
                }
            } else if (stockID.startsWith("00")) {
                if (size >= 2 && size <= 7) {
                    d5.add(stockRankingSto);
                    stockRankingSto.setStockType("右边小");
                } else if (size >= 8 && size <= 30) {
                    e5.add(stockRankingSto);
                    stockRankingSto.setStockType("右边大");
                }
            }
        });


        //双边榜
        reversePackageStockRankingStoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            Long mainId = aacodeToMainIdMap.get(stockID);
            Long size = countByMainId.get(mainId);
            if (stockID.startsWith("60")) {
                if (size >= 2 && size <= 7) {
                    a6.add(stockRankingSto);
                    stockRankingSto.setStockType("双边小");
                } else if (size >= 8 && size <= 30) {
                    b6.add(stockRankingSto);
                    stockRankingSto.setStockType("双边大");
                }
            } else if (stockID.startsWith("00")) {
                if (size >= 2 && size <= 7) {
                    d6.add(stockRankingSto);
                    stockRankingSto.setStockType("双边小");
                } else if (size >= 8 && size <= 30) {
                    e6.add(stockRankingSto);
                    stockRankingSto.setStockType("双边大");
                }
            }
        });


        //双续榜
        continuousStockRankingStoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            Long mainId = aacodeToMainIdMap.get(stockID);
            Long size = countByMainId.get(mainId);
            if (stockID.startsWith("60")) {
                if (size >= 2 && size <= 7) {
                    a7.add(stockRankingSto);
                    stockRankingSto.setStockType("双续小");
                } else if (size >= 8 && size <= 30) {
                    b7.add(stockRankingSto);
                    stockRankingSto.setStockType("双续大");
                }
            } else if (stockID.startsWith("00")) {
                if (size >= 2 && size <= 7) {
                    d7.add(stockRankingSto);
                    stockRankingSto.setStockType("双续小");
                } else if (size >= 8 && size <= 30) {
                    e7.add(stockRankingSto);
                    stockRankingSto.setStockType("双续大");
                }
            }
        });


        //无际榜
        boundlessBoardStoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            Long mainId = aacodeToMainIdMap.get(stockID);
            Long size = countByMainId.get(mainId);
            if (stockID.startsWith("60")) {
                if (size >= 2 && size <= 7) {
                    a8.add(stockRankingSto);
                    stockRankingSto.setStockType("无际小");
                } else if (size >= 8 && size <= 30) {
                    b8.add(stockRankingSto);
                    stockRankingSto.setStockType("无际大");
                }
            } else if (stockID.startsWith("00")) {
                if (size >= 2 && size <= 7) {
                    d8.add(stockRankingSto);
                    stockRankingSto.setStockType("无际小");
                } else if (size >= 8 && size <= 30) {
                    e8.add(stockRankingSto);
                    stockRankingSto.setStockType("无际大");
                }
            }
        });

        //剩余板
        remainBoardStoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            Long mainId = aacodeToMainIdMap.get(stockID);
            Long size = countByMainId.get(mainId);
            if (stockID.startsWith("60")) {
                if (size >= 2 && size <= 7) {
                    a9.add(stockRankingSto);
                    stockRankingSto.setStockType("剩余小");
                } else if (size >= 8 && size <= 30) {
                    b9.add(stockRankingSto);
                    stockRankingSto.setStockType("剩余大");
                }
            } else if (stockID.startsWith("00")) {
                if (size >= 2 && size <= 7) {
                    d9.add(stockRankingSto);
                    stockRankingSto.setStockType("剩余小");
                } else if (size >= 8 && size <= 30) {
                    e9.add(stockRankingSto);
                    stockRankingSto.setStockType("剩余大");
                }
            }
        });


        //首次板
        firstBoardStoList.stream().forEach(stockRankingSto -> {
            String stockID = stockRankingSto.getStockID();
            if (stockID.startsWith("60")) {
                g1.add(stockRankingSto);
                stockRankingSto.setStockType("首次板");

            } else if (stockID.startsWith("00")) {
                g2.add(stockRankingSto);
                stockRankingSto.setStockType("首次板");
            }
        });
        //榜单
        HashMap<String, String> hotListHashMap = new HashMap<>();
        hotListHashMap.put("a1", "两连板小(sh)");
        hotListHashMap.put("a2", "无边榜小(sh)");
        hotListHashMap.put("a3", "左边榜小(sh)");
        hotListHashMap.put("a4", "右续榜小(sh)");
        hotListHashMap.put("a5", "右边榜小(sh)");
        hotListHashMap.put("a6", "双边榜小(sh)");
        hotListHashMap.put("a7", "双续榜小(sh)");
        hotListHashMap.put("a8", "无际榜小(sh)");
        hotListHashMap.put("a9", "剩余板小(sh)");


        hotListHashMap.put("d1", "两连板小(sz)");
        hotListHashMap.put("d2", "无边榜小(sz)");
        hotListHashMap.put("d3", "左边榜小(sz)");
        hotListHashMap.put("d4", "右续榜小(sz)");
        hotListHashMap.put("d5", "右边榜小(sz)");
        hotListHashMap.put("d6", "双边榜小(sz)");
        hotListHashMap.put("d7", "双续榜小(sz)");
        hotListHashMap.put("d8", "无际榜小(sz)");
        hotListHashMap.put("d9", "剩余板小(sz)");


        hotListHashMap.put("b1", "两连板大(sh)");
        hotListHashMap.put("b2", "无边榜大(sh)");
        hotListHashMap.put("b3", "左边榜大(sh)");
        hotListHashMap.put("b4", "右续榜大(sh)");
        hotListHashMap.put("b5", "右边榜大(sh)");
        hotListHashMap.put("b6", "双边榜大(sh)");
        hotListHashMap.put("b7", "双续榜大(sh)");
        hotListHashMap.put("b8", "无际榜大(sh)");
        hotListHashMap.put("b9", "剩余板大(sh)");


        hotListHashMap.put("e1", "两连板大(sz)");
        hotListHashMap.put("e2", "无边榜大(sz)");
        hotListHashMap.put("e3", "左边榜大(sz)");
        hotListHashMap.put("e4", "右续榜大(sz)");
        hotListHashMap.put("e5", "右边榜大(sz)");
        hotListHashMap.put("e6", "双边榜大(sz)");
        hotListHashMap.put("e7", "双续榜大(sz)");
        hotListHashMap.put("e8", "无际榜大(sz)");
        hotListHashMap.put("e9", "剩余板大(sz)");

        hotListHashMap.put("g1", "首次板(sh)");
        hotListHashMap.put("g2", "首次板(sz)");





        Map<String, List<StockRankingSto>> stockRankingStoMap = new LinkedHashMap<>();
        stockRankingStoMap.put("a1", a1);//两连板
        stockRankingStoMap.put("a2", a2);//无边榜
        stockRankingStoMap.put("a3", a3);//左边榜
        stockRankingStoMap.put("a4", a4);//右续榜
        stockRankingStoMap.put("a5", a5);//右边榜
        stockRankingStoMap.put("a6", a6);//双边榜
        stockRankingStoMap.put("a7", a7);//双续榜
        stockRankingStoMap.put("a8", a8);//无际榜
        stockRankingStoMap.put("a9", a9);//剩余板

        stockRankingStoMap.put("d1", d1);//两连板
        stockRankingStoMap.put("d2", d2);//无边榜
        stockRankingStoMap.put("d3", d3);//左边榜
        stockRankingStoMap.put("d4", d4);//右续榜
        stockRankingStoMap.put("d5", d5);//右边榜
        stockRankingStoMap.put("d6", d6);//双边榜
        stockRankingStoMap.put("d7", d7);//双续榜
        stockRankingStoMap.put("d8", d8);//无际榜
        stockRankingStoMap.put("d9", d9);//剩余板


        stockRankingStoMap.put("b1", b1);//两连板
        stockRankingStoMap.put("b2", b2);//无边榜
        stockRankingStoMap.put("b3", b3);//左边榜
        stockRankingStoMap.put("b4", b4);//右续榜
        stockRankingStoMap.put("b5", b5);//右边榜
        stockRankingStoMap.put("b6", b6);//双边榜
        stockRankingStoMap.put("b7", b7);//双续榜
        stockRankingStoMap.put("b8", b8);//无际榜
        stockRankingStoMap.put("b9", b9);//剩余板


        stockRankingStoMap.put("e1", e1);//两连板
        stockRankingStoMap.put("e2", e2);//无边榜
        stockRankingStoMap.put("e3", e3);//左边榜
        stockRankingStoMap.put("e4", e4);//右续榜
        stockRankingStoMap.put("e5", e5);//右边榜
        stockRankingStoMap.put("e6", e6);//双边榜
        stockRankingStoMap.put("e7", e7);//双续榜
        stockRankingStoMap.put("e8", e8);//无际榜
        stockRankingStoMap.put("e9", e9);//剩余板

        stockRankingStoMap.put("g1", g1);//首次板
        stockRankingStoMap.put("g2", g2);//首次板


        StringBuilder twoHtmlBuilder = new StringBuilder();
        // HTML头部和CSS样式
        twoHtmlBuilder.append("<!DOCTYPE html>").append("<html>").append("<head>").append("<meta charset=\"UTF-8\">").append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">").append("<style>").append("body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 20px; background-color: #f8f9fa; }").append(".container { max-width: 100%; margin: 0 auto; background-color: white; padding: 25px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }").append(".header { text-align: center; margin-bottom: 30px; }").append("h1 { color: #2c3e50; margin-bottom: 10px; font-size: 28px; }").append(".subtitle { color: #7f8c8d; font-size: 16px; margin-bottom: 20px; }").append(".bid-card { margin-bottom: 30px; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border: 1px solid #e9ecef; }").append(".bid-header { background: linear-gradient(135deg, #3498db, #2980b9); color: white; padding: 15px 20px; }").append(".bid-name { font-size: 18px; font-weight: 600; }").append("table { width: 100%; border-collapse: collapse; table-layout: fixed; }").append("th { background-color: #f8f9fa; color: #495057; padding: 14px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #e9ecef; }").append("td { padding: 12px; border-bottom: 1px solid #e9ecef; color: #212529; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }").append("tr:last-child td { border-bottom: none; }").append("tr:hover { background-color: #f8f9fa; }").append(".buy-amount { color: #27ae60; font-weight: 600; text-align: right; }").append(".sell-amount { color: #e74c3c; font-weight: 600; text-align: right; }").append(".stock-code { font-family: monospace; }").append(".footer { text-align: center; margin-top: 40px; color: #6c757d; font-size: 14px; padding-top: 20px; border-top: 1px solid #e9ecef; }").append("@media (max-width: 768px) {").append("  .container { padding: 15px; }").append("  th, td { padding: 8px; font-size: 14px; }").append("  h1 { font-size: 24px; }").append("}")
                //换行
                .append(".wrap-cell { word-wrap: break-word; overflow-wrap: break-word; white-space: normal; }").append("</style>").append("</head>").append("<body>").append("<div class='container'>").append("<div class='header'>").append("<h1>股票榜单汇总表</h1>").append("<div class='subtitle'>生成时间: ").append(new Date()).append("</div>").append("</div>");


        twoHtmlBuilder.append("<h2 style='color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 8px; margin-top: 40px;'>").append("交易日期: ").append(tradeDate).append("</h2>");

        for (Map.Entry<String, List<StockRankingSto>> entry : stockRankingStoMap.entrySet()) {
            String key = entry.getKey();
            List<StockRankingSto> StockRankingStovalues = entry.getValue();
             if(StockRankingStovalues.isEmpty()){
                 continue;
             }
            twoHtmlBuilder.append("<div class='bid-card'>").append("<div class='bid-header'>").append("<div class='bid-name'>榜单类型: ").append(hotListHashMap.get(key)).append("</div>").append("</div>").append("<table>").append("<tr>").append("<th style='width: 10%;'>股票名称</th>").append("<th style='width: 10%;'>市值</th>").append("<th style='width: 10%; text-align: right;'>类型</th>").append("<th style='width: 70%; text-align: right;'>概念</th>").append("</tr>");

            // 添加合并后的交易数据
            for (StockRankingSto stockRankingSto : StockRankingStovalues) {
                BigDecimal actualCirculationValue = stockRankingSto.getActualCirculationValue();
                BigDecimal actualCirculationValueRoundingMode = actualCirculationValue.setScale(0, RoundingMode.DOWN);
                twoHtmlBuilder.append("<tr>").append("<td class='stock-code'>").append(stockRankingSto.getStockName()).append("</td>").append("<td>")
                        .append(actualCirculationValueRoundingMode).append("</td>").append("<td class='buy-amount'>")
                        .append(stockRankingSto.getStockType()).append("</td>").append("<td class='wrap-cell'>")
                        .append(stockRankingSto.getConcept()).append("</td>").append("</tr>");
            }


            twoHtmlBuilder.append("</table>").append("</div>");
        }


        // HTML尾部和页脚
        twoHtmlBuilder.append("<div class='footer'>").append("<p>© 2025 股票交易分析系统 | 本邮件由系统自动生成</p>").append("</div>").append("</div>").append("</body>").append("</html>");


        //第三封邮件
        mailService.sendHtml("644258812@qq.com", formatString + " 上榜股票", twoHtmlBuilder.toString());
    }


}


